From 27d17de183f017bc65d9ac15347e6ebf0c28f034 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 29 May 2019 20:05:49 +0200 Subject: [PATCH] registry must be not used here because not yet initialized GitOrigin-RevId: 4731f2911c9a73f0c2e55f45240c51e94379d330 --- .../keyGestures/KeyboardGestureProcessor.java | 5 ++-- .../wm/impl/ToolWindowManagerImpl.java | 2 +- .../util/resources/misc/registry.properties | 4 --- .../openapi/util/LowMemoryWatcherManager.java | 27 +++---------------- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyboardGestureProcessor.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyboardGestureProcessor.java index f5eaee70b22d..ff0fb492a2c8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyboardGestureProcessor.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyboardGestureProcessor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 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-2019 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.keymap.impl.keyGestures; import com.intellij.openapi.actionSystem.*; @@ -6,6 +6,7 @@ import com.intellij.openapi.keymap.impl.ActionProcessor; import com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher; import com.intellij.openapi.keymap.impl.KeyState; import com.intellij.openapi.util.registry.Registry; +import com.intellij.util.SystemProperties; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -36,7 +37,7 @@ public class KeyboardGestureProcessor { } }); - final Timer myDblClickTimer = UIUtil.createNamedTimer("Double click",Registry.intValue("actionSystem.keyGestureDblClickTime"), new ActionListener() { + final Timer myDblClickTimer = UIUtil.createNamedTimer("Double click", SystemProperties.getIntProperty("actionSystem.keyGestureDblClickTime", 650), new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { myState.processDblClickTimer(); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java index 171ec92bf0e0..66167f47fb94 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java @@ -374,7 +374,7 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis private void restartWaitingForSecondPressAlarm() { myWaiterForSecondPress.cancelAllRequests(); - myWaiterForSecondPress.addRequest(mySecondPressRunnable, Registry.intValue("actionSystem.keyGestureDblClickTime")); + myWaiterForSecondPress.addRequest(mySecondPressRunnable, SystemProperties.getIntProperty("actionSystem.keyGestureDblClickTime", 650)); } private boolean hasOpenEditorFiles() { diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 0ab45169f951..10f08346adcc 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -21,7 +21,6 @@ actionSystem.playback.useDirectActionCall=true actionSystem.playback.useTypingTargets=true actionSystem.mac.screenMenuNotUpdatedFix=false actionSystem.keyGestures.enabled=false -actionSystem.keyGestureDblClickTime=650 actionSystem.suspendFocusTransferIfApplicationInactive=true actionSystem.getContextByRecentMouseEvent=false actionSystem.secondKeystrokeTimeout=2000 @@ -1422,9 +1421,6 @@ inplace.change.signature.description=Enables change signature without dialog, in low.memory.watcher.sync=true low.memory.watcher.sync.description=Whether LowMemoryWatcher runnables should be executed on the same thread that the low memory events come -low.memory.watcher.notification.threshold=0.95 -low.memory.watcher.notification.threshold.description=The proportion of maximum heap memory that needs to be exceeded for LowMemoryWatcher listeners to be notified - max.suggested.heap.size=2048 max.suggested.heap.size.description=The maximum Xmx value in megabytes that is going to be suggested by the EditXmxVMOption dialog diff --git a/platform/util/src/com/intellij/openapi/util/LowMemoryWatcherManager.java b/platform/util/src/com/intellij/openapi/util/LowMemoryWatcherManager.java index 327cb9221cb0..65658973bcfd 100644 --- a/platform/util/src/com/intellij/openapi/util/LowMemoryWatcherManager.java +++ b/platform/util/src/com/intellij/openapi/util/LowMemoryWatcherManager.java @@ -1,24 +1,11 @@ -/* - * Copyright 2000-2016 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-2019 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.util; import com.intellij.openapi.Disposable; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.registry.Registry; import com.intellij.util.Consumer; +import com.intellij.util.SystemProperties; import com.intellij.util.concurrency.SequentialTaskExecutor; import org.jetbrains.annotations.NotNull; @@ -29,7 +16,6 @@ import java.lang.management.ManagementFactory; import java.lang.management.MemoryNotificationInfo; import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryType; -import java.util.MissingResourceException; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -103,13 +89,8 @@ public class LowMemoryWatcherManager implements Disposable { } }; - private static double getOccupiedMemoryThreshold() { - try { - return Registry.doubleValue("low.memory.watcher.notification.threshold"); - } - catch (MissingResourceException e) { - return 0.95; - } + private static float getOccupiedMemoryThreshold() { + return SystemProperties.getFloatProperty("low.memory.watcher.notification.threshold", 0.95f); } private void handleEventImmediately(boolean afterGc) {