diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java index a5f54b32c03e..a28aeb7c0445 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java @@ -179,7 +179,7 @@ public final class ActionManagerImpl extends ActionManagerEx implements Disposab obj = ApplicationManager.getApplication().instantiateExtensionWithPicoContainerOnlyIfNeeded(stubClassName, pluginDescriptor); } else { - obj = ReflectionUtil.newInstance(Class.forName(stubClassName, true, pluginDescriptor.getPluginClassLoader())); + obj = ReflectionUtil.newInstance(Class.forName(stubClassName, true, pluginDescriptor.getPluginClassLoader()), false); } } catch (ProcessCanceledException e) { diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java index fb49e4aea674..d568348df956 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java @@ -451,7 +451,7 @@ public final class IdeKeyEventDispatcher implements Disposable { } updateCurrentContext(focusOwner, new KeyboardShortcut(keyStroke, null)); - if(myContext.getActions().isEmpty()) { + if (myContext.getActions().isEmpty()) { // there's nothing mapped for this stroke return false; } @@ -470,7 +470,7 @@ public final class IdeKeyEventDispatcher implements Disposable { DataContext dataContext = myContext.getDataContext(); KeyEvent e = myContext.getInputEvent(); - if(myContext.isHasSecondStroke()){ + if (myContext.isHasSecondStroke()) { myFirstKeyStroke=keyStroke; final ArrayList> secondKeyStrokes = getSecondKeystrokeActions(); @@ -507,7 +507,8 @@ public final class IdeKeyEventDispatcher implements Disposable { setState(KeyState.STATE_WAIT_FOR_SECOND_KEYSTROKE); return true; - }else{ + } + else { return processAction(e, myActionProcessor); } } @@ -783,27 +784,27 @@ public final class IdeKeyEventDispatcher implements Disposable { } } - private void addActionsFromActiveKeymap(@NotNull Shortcut sc) { + private void addActionsFromActiveKeymap(@NotNull Shortcut shortcut) { if (!LoadingState.COMPONENTS_LOADED.isOccurred()) { return; } KeymapManager keymapManager = KeymapManager.getInstance(); Keymap keymap = keymapManager == null ? null : keymapManager.getActiveKeymap(); - String[] actionIds = keymap == null ? ArrayUtilRt.EMPTY_STRING_ARRAY : keymap.getActionIds(sc); + String[] actionIds = keymap == null ? ArrayUtilRt.EMPTY_STRING_ARRAY : keymap.getActionIds(shortcut); ActionManager actionManager = ActionManager.getInstance(); for (String actionId : actionIds) { AnAction action = actionManager.getAction(actionId); if (action != null && (!myContext.isModalContext() || action.isEnabledInModalContext())) { - addAction(action, sc); + addAction(action, shortcut); } } - if (keymap != null && actionIds.length > 0 && sc instanceof KeyboardShortcut) { + if (keymap != null && actionIds.length > 0 && shortcut instanceof KeyboardShortcut) { // user pressed keystroke and keymap has some actions assigned to sc (actions going to be executed) // check whether this shortcut conflicts with system-wide shortcuts and notify user if necessary // see IDEA-173174 Warn user about IDE keymap conflicts with native OS keymap - SystemShortcuts.getInstance().onUserPressedShortcut(keymap, actionIds, (KeyboardShortcut)sc); + SystemShortcuts.getInstance().onUserPressedShortcut(keymap, actionIds, (KeyboardShortcut)shortcut); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeyProcessorContext.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeyProcessorContext.java index 87ed069d1dfa..e25a375c858f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeyProcessorContext.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeyProcessorContext.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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.keymap.impl; import com.intellij.openapi.actionSystem.AnAction; @@ -28,7 +14,7 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; -public class KeyProcessorContext { +public final class KeyProcessorContext { private final List myActions = new ArrayList<>(); private WeakReference myFoundComponent; private boolean myHasSecondStroke; @@ -48,11 +34,11 @@ public class KeyProcessorContext { return SoftReference.dereference(myFoundComponent); } - public void setFoundComponent(final JComponent foundComponent) { + public void setFoundComponent(JComponent foundComponent) { myFoundComponent = new WeakReference<>(foundComponent); } - public void setHasSecondStroke(final boolean hasSecondStroke) { + public void setHasSecondStroke(boolean hasSecondStroke) { myHasSecondStroke = hasSecondStroke; } @@ -64,7 +50,7 @@ public class KeyProcessorContext { return myDataContext; } - public void setDataContext(final DataContext dataContext) { + public void setDataContext(DataContext dataContext) { myDataContext = dataContext; } @@ -72,7 +58,7 @@ public class KeyProcessorContext { return isModalContext; } - public void setModalContext(final boolean modalContext) { + public void setModalContext(boolean modalContext) { isModalContext = modalContext; } @@ -81,11 +67,11 @@ public class KeyProcessorContext { return SoftReference.dereference(myFocusOwner); } - public void setFocusOwner(final Component focusOwner) { + public void setFocusOwner(Component focusOwner) { myFocusOwner = new WeakReference<>(focusOwner); } - public void setInputEvent(final KeyEvent e) { + public void setInputEvent(KeyEvent e) { myInputEvent = e; } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.kt b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.kt index 071743b4bfb1..23f84cc4259a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.kt +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.kt @@ -172,7 +172,7 @@ open class ToolWindowManagerImpl(val project: Project) : ToolWindowManagerEx(), val connection = ApplicationManager.getApplication().messageBus.connect() connection.subscribe(ProjectManager.TOPIC, object : ProjectManagerListener { override fun projectClosed(project: Project) { - (getInstance(project) as ToolWindowManagerImpl).projectClosed() + (project.serviceIfCreated() as ToolWindowManagerImpl?)?.projectClosed() } })