mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ObjectStoredProperty — null equals to bean with default values and vice versa
This commit is contained in:
@@ -16,13 +16,13 @@ class AppletConfigurationOptions : ModuleBasedConfigurationOptions() {
|
||||
var htmlFileName by string()
|
||||
|
||||
@get:OptionTag("HTML_USED")
|
||||
var htmlUsed by storedProperty(false)
|
||||
var htmlUsed by property(false)
|
||||
|
||||
@get:OptionTag("WIDTH")
|
||||
var width by storedProperty(400)
|
||||
var width by property(400)
|
||||
|
||||
@get:OptionTag("HEIGHT")
|
||||
var height by storedProperty(300)
|
||||
var height by property(300)
|
||||
|
||||
@get:OptionTag("POLICY_FILE")
|
||||
var policyFile by string(ExternalizablePath.urlValue("${PathManager.getHomePath()}/bin/appletviewer.policy"))
|
||||
@@ -31,7 +31,7 @@ class AppletConfigurationOptions : ModuleBasedConfigurationOptions() {
|
||||
var vmParameters by string()
|
||||
|
||||
@get:OptionTag("ALTERNATIVE_JRE_PATH_ENABLED")
|
||||
var alternativeJrePathEnabled by storedProperty(false)
|
||||
var alternativeJrePathEnabled by property(false)
|
||||
|
||||
@get:OptionTag("ALTERNATIVE_JRE_PATH")
|
||||
var alternativeJrePath by string()
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.openapi.roots
|
||||
|
||||
@@ -21,5 +9,5 @@ import com.intellij.util.xmlb.annotations.Attribute
|
||||
|
||||
class LanguageLevelState : BaseState() {
|
||||
@get:Attribute("LANGUAGE_LEVEL")
|
||||
var languageLevel by storedProperty<LanguageLevel?>()
|
||||
var languageLevel by property<LanguageLevel?>()
|
||||
}
|
||||
@@ -12,18 +12,46 @@ internal class AState(languageLevel: String? = null, nestedComplex: NestedState?
|
||||
|
||||
var bar by string()
|
||||
|
||||
var property2 by storedProperty(0)
|
||||
var property2 by property(0)
|
||||
|
||||
var floatProperty by storedProperty(0.3)
|
||||
var floatProperty by property(0.3)
|
||||
|
||||
var nestedComplex by storedProperty<NestedState?>(nestedComplex)
|
||||
var nestedComplex by property(nestedComplex)
|
||||
}
|
||||
|
||||
internal class NestedState : BaseState() {
|
||||
var childProperty by storedProperty<String?>()
|
||||
var childProperty by property<String?>()
|
||||
}
|
||||
|
||||
class StoredPropertyStateTest {
|
||||
private class Foo : BaseState() {
|
||||
var bar by property<AState>()
|
||||
}
|
||||
|
||||
private class Foo2 : BaseState() {
|
||||
var bar by property<AState?>(AState())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `default null equals to bean with default property values`() {
|
||||
val f1 = Foo()
|
||||
val f2 = Foo()
|
||||
f2.bar = AState()
|
||||
|
||||
assertThat(f1.serialize()).isNull()
|
||||
assertThat(f2.serialize()).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `bean with default property values equals to default null`() {
|
||||
val f1 = Foo2()
|
||||
val f2 = Foo2()
|
||||
f2.bar = null
|
||||
|
||||
assertThat(f1.serialize()).isNull()
|
||||
assertThat(f2.serialize()).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun test() {
|
||||
val state = AState()
|
||||
|
||||
@@ -19,7 +19,7 @@ public enum AntialiasingType {
|
||||
UISettings uiSettings = ApplicationManager.getApplication() == null ? null : UISettings.getInstance();
|
||||
if (uiSettings != null) {
|
||||
AntialiasingType type = uiSettings.getIdeAAType();
|
||||
if (type != null) return type.getTextInfo();
|
||||
return type.getTextInfo();
|
||||
}
|
||||
return GREYSCALE.getTextInfo();
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public enum AntialiasingType {
|
||||
UISettings uiSettings = ApplicationManager.getApplication() == null ? null : UISettings.getInstance();
|
||||
if (uiSettings != null) {
|
||||
AntialiasingType type = inEditor ? uiSettings.getEditorAAType() : uiSettings.getIdeAAType();
|
||||
if (type != null) return type.myHint;
|
||||
return type.myHint;
|
||||
}
|
||||
return RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.ide.ui
|
||||
|
||||
@@ -53,76 +41,76 @@ class UISettings : BaseState(), PersistentStateComponent<UISettings> {
|
||||
|
||||
@get:Property(filter = FontFilter::class)
|
||||
@get:OptionTag("FONT_SIZE")
|
||||
var fontSize by storedProperty(defFontSize)
|
||||
var fontSize by property(defFontSize)
|
||||
|
||||
@get:Property(filter = FontFilter::class)
|
||||
@get:OptionTag("FONT_SCALE")
|
||||
var fontScale by storedProperty(0f)
|
||||
var fontScale by property(0f)
|
||||
|
||||
@get:OptionTag("RECENT_FILES_LIMIT") var recentFilesLimit by storedProperty(50)
|
||||
@get:OptionTag("CONSOLE_COMMAND_HISTORY_LIMIT") var consoleCommandHistoryLimit by storedProperty(300)
|
||||
@get:OptionTag("OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE") var overrideConsoleCycleBufferSize by storedProperty(false)
|
||||
@get:OptionTag("CONSOLE_CYCLE_BUFFER_SIZE_KB") var consoleCycleBufferSizeKb by storedProperty(1024)
|
||||
@get:OptionTag("EDITOR_TAB_LIMIT") var editorTabLimit by storedProperty(10)
|
||||
@get:OptionTag("RECENT_FILES_LIMIT") var recentFilesLimit by property(50)
|
||||
@get:OptionTag("CONSOLE_COMMAND_HISTORY_LIMIT") var consoleCommandHistoryLimit by property(300)
|
||||
@get:OptionTag("OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE") var overrideConsoleCycleBufferSize by property(false)
|
||||
@get:OptionTag("CONSOLE_CYCLE_BUFFER_SIZE_KB") var consoleCycleBufferSizeKb by property(1024)
|
||||
@get:OptionTag("EDITOR_TAB_LIMIT") var editorTabLimit by property(10)
|
||||
|
||||
@get:OptionTag("REUSE_NOT_MODIFIED_TABS") var reuseNotModifiedTabs by storedProperty(false)
|
||||
@get:OptionTag("ANIMATE_WINDOWS") var animateWindows by storedProperty(true)
|
||||
@get:OptionTag("SHOW_TOOL_WINDOW_NUMBERS") var showToolWindowsNumbers by storedProperty(true)
|
||||
@get:OptionTag("HIDE_TOOL_STRIPES") var hideToolStripes by storedProperty(true)
|
||||
@get:OptionTag("WIDESCREEN_SUPPORT") var wideScreenSupport by storedProperty(false)
|
||||
@get:OptionTag("LEFT_HORIZONTAL_SPLIT") var leftHorizontalSplit by storedProperty(false)
|
||||
@get:OptionTag("RIGHT_HORIZONTAL_SPLIT") var rightHorizontalSplit by storedProperty(false)
|
||||
@get:OptionTag("SHOW_EDITOR_TOOLTIP") var showEditorToolTip by storedProperty(true)
|
||||
@get:OptionTag("SHOW_MEMORY_INDICATOR") var showMemoryIndicator by storedProperty(false)
|
||||
@get:OptionTag("ALLOW_MERGE_BUTTONS") var allowMergeButtons by storedProperty(true)
|
||||
@get:OptionTag("SHOW_MAIN_TOOLBAR") var showMainToolbar by storedProperty(false)
|
||||
@get:OptionTag("SHOW_STATUS_BAR") var showStatusBar by storedProperty(true)
|
||||
@get:OptionTag("SHOW_NAVIGATION_BAR") var showNavigationBar by storedProperty(true)
|
||||
@get:OptionTag("ALWAYS_SHOW_WINDOW_BUTTONS") var alwaysShowWindowsButton by storedProperty(false)
|
||||
@get:OptionTag("CYCLE_SCROLLING") var cycleScrolling by storedProperty(true)
|
||||
@get:OptionTag("SCROLL_TAB_LAYOUT_IN_EDITOR") var scrollTabLayoutInEditor by storedProperty(true)
|
||||
@get:OptionTag("HIDE_TABS_IF_NEED") var hideTabsIfNeed by storedProperty(true)
|
||||
@get:OptionTag("SHOW_CLOSE_BUTTON") var showCloseButton by storedProperty(true)
|
||||
@get:OptionTag("EDITOR_TAB_PLACEMENT") var editorTabPlacement by storedProperty(SwingConstants.TOP)
|
||||
@get:OptionTag("HIDE_KNOWN_EXTENSION_IN_TABS") var hideKnownExtensionInTabs by storedProperty(false)
|
||||
@get:OptionTag("SHOW_ICONS_IN_QUICK_NAVIGATION") var showIconInQuickNavigation by storedProperty(true)
|
||||
@get:OptionTag("REUSE_NOT_MODIFIED_TABS") var reuseNotModifiedTabs by property(false)
|
||||
@get:OptionTag("ANIMATE_WINDOWS") var animateWindows by property(true)
|
||||
@get:OptionTag("SHOW_TOOL_WINDOW_NUMBERS") var showToolWindowsNumbers by property(true)
|
||||
@get:OptionTag("HIDE_TOOL_STRIPES") var hideToolStripes by property(true)
|
||||
@get:OptionTag("WIDESCREEN_SUPPORT") var wideScreenSupport by property(false)
|
||||
@get:OptionTag("LEFT_HORIZONTAL_SPLIT") var leftHorizontalSplit by property(false)
|
||||
@get:OptionTag("RIGHT_HORIZONTAL_SPLIT") var rightHorizontalSplit by property(false)
|
||||
@get:OptionTag("SHOW_EDITOR_TOOLTIP") var showEditorToolTip by property(true)
|
||||
@get:OptionTag("SHOW_MEMORY_INDICATOR") var showMemoryIndicator by property(false)
|
||||
@get:OptionTag("ALLOW_MERGE_BUTTONS") var allowMergeButtons by property(true)
|
||||
@get:OptionTag("SHOW_MAIN_TOOLBAR") var showMainToolbar by property(false)
|
||||
@get:OptionTag("SHOW_STATUS_BAR") var showStatusBar by property(true)
|
||||
@get:OptionTag("SHOW_NAVIGATION_BAR") var showNavigationBar by property(true)
|
||||
@get:OptionTag("ALWAYS_SHOW_WINDOW_BUTTONS") var alwaysShowWindowsButton by property(false)
|
||||
@get:OptionTag("CYCLE_SCROLLING") var cycleScrolling by property(true)
|
||||
@get:OptionTag("SCROLL_TAB_LAYOUT_IN_EDITOR") var scrollTabLayoutInEditor by property(true)
|
||||
@get:OptionTag("HIDE_TABS_IF_NEED") var hideTabsIfNeed by property(true)
|
||||
@get:OptionTag("SHOW_CLOSE_BUTTON") var showCloseButton by property(true)
|
||||
@get:OptionTag("EDITOR_TAB_PLACEMENT") var editorTabPlacement by property(SwingConstants.TOP)
|
||||
@get:OptionTag("HIDE_KNOWN_EXTENSION_IN_TABS") var hideKnownExtensionInTabs by property(false)
|
||||
@get:OptionTag("SHOW_ICONS_IN_QUICK_NAVIGATION") var showIconInQuickNavigation by property(true)
|
||||
|
||||
@get:OptionTag("CLOSE_NON_MODIFIED_FILES_FIRST") var closeNonModifiedFilesFirst by storedProperty(false)
|
||||
@get:OptionTag("ACTIVATE_MRU_EDITOR_ON_CLOSE") var activeMruEditorOnClose by storedProperty(false)
|
||||
@get:OptionTag("CLOSE_NON_MODIFIED_FILES_FIRST") var closeNonModifiedFilesFirst by property(false)
|
||||
@get:OptionTag("ACTIVATE_MRU_EDITOR_ON_CLOSE") var activeMruEditorOnClose by property(false)
|
||||
// TODO[anton] consider making all IDEs use the same settings
|
||||
@get:OptionTag("ACTIVATE_RIGHT_EDITOR_ON_CLOSE") var activeRightEditorOnClose by storedProperty(PlatformUtils.isAppCode())
|
||||
@get:OptionTag("ACTIVATE_RIGHT_EDITOR_ON_CLOSE") var activeRightEditorOnClose by property(PlatformUtils.isAppCode())
|
||||
|
||||
@get:OptionTag("IDE_AA_TYPE") var ideAAType by storedProperty(AntialiasingType.SUBPIXEL)
|
||||
@get:OptionTag("EDITOR_AA_TYPE") var editorAAType by storedProperty(AntialiasingType.SUBPIXEL)
|
||||
@get:OptionTag("COLOR_BLINDNESS") var colorBlindness by storedProperty<ColorBlindness?>()
|
||||
@get:OptionTag("MOVE_MOUSE_ON_DEFAULT_BUTTON") var moveMouseOnDefaultButton by storedProperty(false)
|
||||
@get:OptionTag("ENABLE_ALPHA_MODE") var enableAlphaMode by storedProperty(false)
|
||||
@get:OptionTag("ALPHA_MODE_DELAY") var alphaModeDelay by storedProperty(1500)
|
||||
@get:OptionTag("ALPHA_MODE_RATIO") var alphaModeRatio by storedProperty(0.5f)
|
||||
@get:OptionTag("MAX_CLIPBOARD_CONTENTS") var maxClipboardContents by storedProperty(5)
|
||||
@get:OptionTag("OVERRIDE_NONIDEA_LAF_FONTS") var overrideLafFonts by storedProperty(false)
|
||||
@get:OptionTag("SHOW_ICONS_IN_MENUS") var showIconsInMenus by storedProperty(!PlatformUtils.isAppCode())
|
||||
@get:OptionTag("IDE_AA_TYPE") var ideAAType by property(AntialiasingType.SUBPIXEL)
|
||||
@get:OptionTag("EDITOR_AA_TYPE") var editorAAType by property(AntialiasingType.SUBPIXEL)
|
||||
@get:OptionTag("COLOR_BLINDNESS") var colorBlindness by property<ColorBlindness?>()
|
||||
@get:OptionTag("MOVE_MOUSE_ON_DEFAULT_BUTTON") var moveMouseOnDefaultButton by property(false)
|
||||
@get:OptionTag("ENABLE_ALPHA_MODE") var enableAlphaMode by property(false)
|
||||
@get:OptionTag("ALPHA_MODE_DELAY") var alphaModeDelay by property(1500)
|
||||
@get:OptionTag("ALPHA_MODE_RATIO") var alphaModeRatio by property(0.5f)
|
||||
@get:OptionTag("MAX_CLIPBOARD_CONTENTS") var maxClipboardContents by property(5)
|
||||
@get:OptionTag("OVERRIDE_NONIDEA_LAF_FONTS") var overrideLafFonts by property(false)
|
||||
@get:OptionTag("SHOW_ICONS_IN_MENUS") var showIconsInMenus by property(!PlatformUtils.isAppCode())
|
||||
// IDEADEV-33409, should be disabled by default on MacOS
|
||||
@get:OptionTag("DISABLE_MNEMONICS") var disableMnemonics by storedProperty(SystemInfo.isMac)
|
||||
@get:OptionTag("DISABLE_MNEMONICS_IN_CONTROLS") var disableMnemonicsInControls by storedProperty(false)
|
||||
@get:OptionTag("USE_SMALL_LABELS_ON_TABS") var useSmallLabelsOnTabs by storedProperty(SystemInfo.isMac)
|
||||
@get:OptionTag("MAX_LOOKUP_WIDTH2") var maxLookupWidth by storedProperty(500)
|
||||
@get:OptionTag("MAX_LOOKUP_LIST_HEIGHT") var maxLookupListHeight by storedProperty(11)
|
||||
@get:OptionTag("HIDE_NAVIGATION_ON_FOCUS_LOSS") var hideNavigationOnFocusLoss by storedProperty(true)
|
||||
@get:OptionTag("DND_WITH_PRESSED_ALT_ONLY") var dndWithPressedAltOnly by storedProperty(false)
|
||||
@get:OptionTag("DEFAULT_AUTOSCROLL_TO_SOURCE") var defaultAutoScrollToSource by storedProperty(false)
|
||||
@get:OptionTag("DISABLE_MNEMONICS") var disableMnemonics by property(SystemInfo.isMac)
|
||||
@get:OptionTag("DISABLE_MNEMONICS_IN_CONTROLS") var disableMnemonicsInControls by property(false)
|
||||
@get:OptionTag("USE_SMALL_LABELS_ON_TABS") var useSmallLabelsOnTabs by property(SystemInfo.isMac)
|
||||
@get:OptionTag("MAX_LOOKUP_WIDTH2") var maxLookupWidth by property(500)
|
||||
@get:OptionTag("MAX_LOOKUP_LIST_HEIGHT") var maxLookupListHeight by property(11)
|
||||
@get:OptionTag("HIDE_NAVIGATION_ON_FOCUS_LOSS") var hideNavigationOnFocusLoss by property(true)
|
||||
@get:OptionTag("DND_WITH_PRESSED_ALT_ONLY") var dndWithPressedAltOnly by property(false)
|
||||
@get:OptionTag("DEFAULT_AUTOSCROLL_TO_SOURCE") var defaultAutoScrollToSource by property(false)
|
||||
@Transient var presentationMode = false
|
||||
@get:OptionTag("PRESENTATION_MODE_FONT_SIZE") var presentationModeFontSize by storedProperty(24)
|
||||
@get:OptionTag("MARK_MODIFIED_TABS_WITH_ASTERISK") var markModifiedTabsWithAsterisk by storedProperty(false)
|
||||
@get:OptionTag("SHOW_TABS_TOOLTIPS") var showTabsTooltips by storedProperty(true)
|
||||
@get:OptionTag("SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES") var showDirectoryForNonUniqueFilenames by storedProperty(true)
|
||||
var smoothScrolling by storedProperty(SystemInfo.isMac && (SystemInfo.isJetBrainsJvm || SystemInfo.isJavaVersionAtLeast("9")))
|
||||
@get:OptionTag("NAVIGATE_TO_PREVIEW") var navigateToPreview by storedProperty(false)
|
||||
@get:OptionTag("PRESENTATION_MODE_FONT_SIZE") var presentationModeFontSize by property(24)
|
||||
@get:OptionTag("MARK_MODIFIED_TABS_WITH_ASTERISK") var markModifiedTabsWithAsterisk by property(false)
|
||||
@get:OptionTag("SHOW_TABS_TOOLTIPS") var showTabsTooltips by property(true)
|
||||
@get:OptionTag("SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES") var showDirectoryForNonUniqueFilenames by property(true)
|
||||
var smoothScrolling by property(SystemInfo.isMac && (SystemInfo.isJetBrainsJvm || SystemInfo.isJavaVersionAtLeast("9")))
|
||||
@get:OptionTag("NAVIGATE_TO_PREVIEW") var navigateToPreview by property(false)
|
||||
|
||||
@get:OptionTag("SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY") var sortLookupElementsLexicographically by storedProperty(false)
|
||||
@get:OptionTag("MERGE_EQUAL_STACKTRACES") var mergeEqualStackTraces by storedProperty(true)
|
||||
@get:OptionTag("SORT_BOOKMARKS") var sortBookmarks by storedProperty(false)
|
||||
@get:OptionTag("PIN_FIND_IN_PATH_POPUP") var pinFindInPath by storedProperty(false)
|
||||
@get:OptionTag("SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY") var sortLookupElementsLexicographically by property(false)
|
||||
@get:OptionTag("MERGE_EQUAL_STACKTRACES") var mergeEqualStackTraces by property(true)
|
||||
@get:OptionTag("SORT_BOOKMARKS") var sortBookmarks by property(false)
|
||||
@get:OptionTag("PIN_FIND_IN_PATH_POPUP") var pinFindInPath by property(false)
|
||||
|
||||
private val myTreeDispatcher = ComponentTreeEventDispatcher.create(UISettingsListener::class.java)
|
||||
|
||||
|
||||
@@ -27,11 +27,7 @@ class LogFileOptions : BaseState {
|
||||
@JvmStatic
|
||||
fun collectMatchedFiles(root: File, pattern: Pattern, files: MutableList<File>) {
|
||||
val dirs = root.listFiles() ?: return
|
||||
for (dir in dirs) {
|
||||
if (pattern.matcher(dir.name).matches() && dir.isFile) {
|
||||
files.add(dir)
|
||||
}
|
||||
}
|
||||
dirs.filterTo(files) { pattern.matcher(it.name).matches() && it.isFile }
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -55,16 +51,16 @@ class LogFileOptions : BaseState {
|
||||
var pathPattern by string()
|
||||
|
||||
@get:Attribute("checked")
|
||||
var isEnabled by storedProperty(true)
|
||||
var isEnabled by property(true)
|
||||
|
||||
@get:Attribute("skipped")
|
||||
var isSkipContent by storedProperty(true)
|
||||
var isSkipContent by property(true)
|
||||
|
||||
@get:Attribute("show_all")
|
||||
var isShowAll by storedProperty(false)
|
||||
var isShowAll by property(false)
|
||||
|
||||
@get:Attribute(value = "charset", converter = CharsetConverter::class)
|
||||
var charset by storedProperty(Charset.defaultCharset())
|
||||
var charset by property<Charset>(Charset.defaultCharset())
|
||||
|
||||
fun getPaths(): Set<String> {
|
||||
val logFile = File(pathPattern!!)
|
||||
@@ -108,8 +104,7 @@ class LogFileOptions : BaseState {
|
||||
}
|
||||
|
||||
//read external
|
||||
constructor() {
|
||||
}
|
||||
constructor()
|
||||
|
||||
@JvmOverloads
|
||||
constructor(name: String?, path: String?, enabled: Boolean = true, skipContent: Boolean = true, showAll: Boolean = false) : this(name, path, null, enabled, skipContent, showAll)
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@ open class RunConfigurationOptions : BaseState() {
|
||||
@get:Attribute("path")
|
||||
var fileOutputPath by string()
|
||||
@get:Attribute("is_save")
|
||||
var isSaveOutput by storedProperty(false)
|
||||
var isSaveOutput by property(false)
|
||||
}
|
||||
|
||||
// we use object instead of 2 fields because XML serializer cannot reuse tag for several fields
|
||||
@@ -20,9 +20,9 @@ open class RunConfigurationOptions : BaseState() {
|
||||
var fileOutput by bean(OutputFileOptions())
|
||||
|
||||
@get:Attribute("show_console_on_std_out")
|
||||
var isShowConsoleOnStdOut by storedProperty(false)
|
||||
var isShowConsoleOnStdOut by property(false)
|
||||
@get:Attribute("show_console_on_std_err")
|
||||
var isShowConsoleOnStdErr by storedProperty(false)
|
||||
var isShowConsoleOnStdErr by property(false)
|
||||
|
||||
@get:Property(surroundWithTag = false)
|
||||
@get:XCollection
|
||||
@@ -30,7 +30,7 @@ open class RunConfigurationOptions : BaseState() {
|
||||
}
|
||||
|
||||
open class LocatableRunConfigurationOptions : RunConfigurationOptions() {
|
||||
@get:Attribute("nameIsGenerated") var isNameGenerated by storedProperty(false)
|
||||
@get:Attribute("nameIsGenerated") var isNameGenerated by property(false)
|
||||
}
|
||||
|
||||
open class ModuleBasedConfigurationOptions : LocatableRunConfigurationOptions() {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.openapi.wm.impl
|
||||
|
||||
import com.intellij.openapi.components.*
|
||||
@@ -51,10 +53,10 @@ class ProjectFrameBounds(private val project: Project) : PersistentStateComponen
|
||||
|
||||
class FrameInfo : BaseState() {
|
||||
// flat is used due to backward compatibility
|
||||
@get:Property(flat = true) var bounds by storedProperty<Rectangle>()
|
||||
@get:Attribute var extendedState by storedProperty(Frame.NORMAL)
|
||||
@get:Property(flat = true) var bounds by property<Rectangle>()
|
||||
@get:Attribute var extendedState by property(Frame.NORMAL)
|
||||
|
||||
@get:Attribute var fullScreen by storedProperty(false)
|
||||
@get:Attribute var fullScreen by property(false)
|
||||
}
|
||||
|
||||
fun WindowManagerImpl.getFrameInfoInDeviceSpace(project: Project): FrameInfo? {
|
||||
|
||||
@@ -30,12 +30,18 @@ abstract class BaseState : SerializationFilter, ModificationTracker {
|
||||
ownModificationCount++
|
||||
}
|
||||
|
||||
fun <T> storedProperty(defaultValue: T? = null): StoredPropertyBase<T?> {
|
||||
fun <T> property(defaultValue: T): StoredPropertyBase<T> {
|
||||
val result = ObjectStoredProperty(defaultValue)
|
||||
properties.add(result)
|
||||
return result
|
||||
}
|
||||
|
||||
fun <T> property(): StoredPropertyBase<T?> {
|
||||
val result = ObjectStoredProperty<T?>(null)
|
||||
properties.add(result)
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Not-null list. Initialized as SmartList.
|
||||
*/
|
||||
@@ -66,25 +72,25 @@ abstract class BaseState : SerializationFilter, ModificationTracker {
|
||||
return result
|
||||
}
|
||||
|
||||
fun storedProperty(defaultValue: Int = 0): StoredPropertyBase<Int> {
|
||||
fun property(defaultValue: Int = 0): StoredPropertyBase<Int> {
|
||||
val result = IntStoredProperty(defaultValue)
|
||||
properties.add(result)
|
||||
return result
|
||||
}
|
||||
|
||||
fun storedProperty(defaultValue: Long = 0): StoredPropertyBase<Long> {
|
||||
fun property(defaultValue: Long = 0): StoredPropertyBase<Long> {
|
||||
val result = LongStoredProperty(defaultValue)
|
||||
properties.add(result)
|
||||
return result
|
||||
}
|
||||
|
||||
fun storedProperty(defaultValue: Float = 0f): StoredPropertyBase<Float> {
|
||||
fun property(defaultValue: Float = 0f): StoredPropertyBase<Float> {
|
||||
val result = FloatStoredProperty(defaultValue)
|
||||
properties.add(result)
|
||||
return result
|
||||
}
|
||||
|
||||
fun storedProperty(defaultValue: Boolean = false): StoredPropertyBase<Boolean> {
|
||||
fun property(defaultValue: Boolean = false): StoredPropertyBase<Boolean> {
|
||||
val result = ObjectStoredProperty(defaultValue)
|
||||
properties.add(result)
|
||||
return result
|
||||
@@ -104,6 +110,8 @@ abstract class BaseState : SerializationFilter, ModificationTracker {
|
||||
return true
|
||||
}
|
||||
|
||||
internal fun isEqualToDefault() = properties.all { it.isEqualToDefault() }
|
||||
|
||||
@Transient
|
||||
override fun getModificationCount(): Long {
|
||||
var result = ownModificationCount
|
||||
|
||||
@@ -18,7 +18,14 @@ internal class ObjectStoredProperty<T>(private val defaultValue: T) : StoredProp
|
||||
}
|
||||
}
|
||||
|
||||
override fun isEqualToDefault() = defaultValue == value
|
||||
override fun isEqualToDefault(): Boolean {
|
||||
val value = value
|
||||
return when {
|
||||
defaultValue == value -> true
|
||||
value == null -> defaultValue is BaseState && defaultValue.isEqualToDefault()
|
||||
else -> defaultValue == null && value is BaseState && value.isEqualToDefault()
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?) = this === other || (other is ObjectStoredProperty<*> && value == other.value)
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class BreakpointManagerState : BaseState() {
|
||||
@get:Tag("breakpoints-dialog")
|
||||
var breakpointsDialogProperties: XBreakpointsDialogState? = null
|
||||
|
||||
var time by storedProperty(0L)
|
||||
var time by property(0L)
|
||||
var defaultGroup by string()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.ide.browsers
|
||||
|
||||
@@ -125,11 +113,11 @@ internal class LaunchBrowserBeforeRunTaskProvider : BeforeRunTaskProvider<Launch
|
||||
|
||||
internal class LaunchBrowserBeforeRunTaskState : BaseState() {
|
||||
@get:Attribute(value = "browser", converter = WebBrowserReferenceConverter::class)
|
||||
var browser by storedProperty<WebBrowser>()
|
||||
var browser by property<WebBrowser>()
|
||||
@get:Attribute()
|
||||
var url by string()
|
||||
@get:Attribute()
|
||||
var withDebugger by storedProperty(false)
|
||||
var withDebugger by property(false)
|
||||
}
|
||||
|
||||
internal class LaunchBrowserBeforeRunTask : BeforeRunTask<LaunchBrowserBeforeRunTask>(LaunchBrowserBeforeRunTaskProvider.ID), PersistentStateComponent<LaunchBrowserBeforeRunTaskState> {
|
||||
|
||||
Reference in New Issue
Block a user