mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CloseWindow action is totally unnecessary. It is only bound in Emacs keymap (to esc+esc), which works anyway thanks to DialogWrapper local shortcut bindings.
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
*/
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.wm.impl.IdeFrameImpl;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
/**
|
||||
* @author Vladimir Kondratyev
|
||||
*/
|
||||
public class CloseWindowAction extends AnAction implements DumbAware {
|
||||
public CloseWindowAction(){
|
||||
setEnabledInModalContext(true);
|
||||
}
|
||||
|
||||
private static Window getWindow(){
|
||||
Window focusedWindow=KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow();
|
||||
if(!(focusedWindow instanceof Dialog) && !(focusedWindow instanceof Frame)){
|
||||
return null;
|
||||
}
|
||||
if(focusedWindow instanceof Dialog){
|
||||
Dialog dialog=(Dialog)focusedWindow;
|
||||
if(!dialog.isUndecorated()){
|
||||
return focusedWindow;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}else if(!(focusedWindow instanceof IdeFrameImpl)){
|
||||
Frame frame=(Frame)focusedWindow;
|
||||
if(!frame.isUndecorated()){
|
||||
return focusedWindow;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e){
|
||||
Window window=getWindow();
|
||||
WindowEvent event=new WindowEvent(window,WindowEvent.WINDOW_CLOSING);
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
|
||||
public void update(AnActionEvent e){
|
||||
super.update(e);
|
||||
e.getPresentation().setEnabled(getWindow()!=null);
|
||||
}
|
||||
}
|
||||
@@ -828,7 +828,6 @@
|
||||
<action id="Refresh">
|
||||
<keyboard-shortcut first-keystroke="control F5"/>
|
||||
</action>
|
||||
<action id="CloseWindow"/>
|
||||
<action id="Rerun">
|
||||
<keyboard-shortcut first-keystroke="control F5"/>
|
||||
</action>
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
<keyboard-shortcut first-keystroke="shift control W" />
|
||||
</action>
|
||||
<action id="CloseEditor" />
|
||||
<action id="CloseWindow" />
|
||||
<action id="CodeInspection.OnEditor" />
|
||||
<action id="CollapseAllRegions">
|
||||
<keyboard-shortcut first-keystroke="shift control DIVIDE" />
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<component>
|
||||
<keymap name="Emacs" parent="$default" version="1" disable-mnemonics="false">
|
||||
<action id="CloseWindow">
|
||||
<keyboard-shortcut first-keystroke="ESCAPE" second-keystroke="ESCAPE"/>
|
||||
</action>
|
||||
<action id="EditorEscape">
|
||||
<keyboard-shortcut first-keystroke="ESCAPE" second-keystroke="ESCAPE"/>
|
||||
</action>
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
<keyboard-shortcut first-keystroke="END"/>
|
||||
<keyboard-shortcut first-keystroke="meta RIGHT"/>
|
||||
</action>
|
||||
<action id="CloseWindow"/>
|
||||
<action id="Exit">
|
||||
<keyboard-shortcut first-keystroke="meta Q"/>
|
||||
</action>
|
||||
|
||||
@@ -237,7 +237,6 @@
|
||||
<keyboard-shortcut first-keystroke="END"/>
|
||||
<keyboard-shortcut first-keystroke="meta RIGHT"/>
|
||||
</action>
|
||||
<action id="CloseWindow"/>
|
||||
<action id="Exit">
|
||||
<keyboard-shortcut first-keystroke="meta Q"/>
|
||||
</action>
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
<keyboard-shortcut first-keystroke="control F4" />
|
||||
<keyboard-shortcut first-keystroke="control W" />
|
||||
</action>
|
||||
<action id="CloseWindow" />
|
||||
<action id="CodeCompletion">
|
||||
<keyboard-shortcut first-keystroke="control SPACE" />
|
||||
<keyboard-shortcut first-keystroke="control BACK_SLASH" />
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<action id="ContextHelp" class="com.intellij.ide.actions.ContextHelpAction"/>
|
||||
<action id="RunGc" class="com.intellij.ide.actions.RunGcAction"/>
|
||||
<action id="ShowPopupMenu" class="com.intellij.ide.actions.ShowPopupMenuAction"/>
|
||||
<action id="CloseWindow" class="com.intellij.ide.actions.CloseWindowAction"/>
|
||||
|
||||
<action id="NextEditorTab" class="com.intellij.openapi.fileEditor.impl.SelectNextEditorTabAction"/>
|
||||
<action id="PreviousEditorTab" class="com.intellij.openapi.fileEditor.impl.SelectPreviousEditorTabAction"/>
|
||||
|
||||
Reference in New Issue
Block a user