GitOrigin-RevId: 7d0141cbc9a4072ed6152e6f709b311d362c4e30
This commit is contained in:
Vladimir Krivosheev
2019-12-20 09:01:34 +00:00
committed by intellij-monorepo-bot
parent 372e0146fe
commit b1d156ad73
4 changed files with 19 additions and 32 deletions
@@ -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) {
@@ -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<Pair<AnAction, KeyStroke>> 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);
}
}
@@ -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<AnAction> myActions = new ArrayList<>();
private WeakReference<JComponent> 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;
}
@@ -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<ToolWindowManager>() as ToolWindowManagerImpl?)?.projectClosed()
}
})