From 4206aea3a47f489e8dd002208e15d3c3dcab9d96 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Sat, 28 Apr 2012 18:31:52 +0400 Subject: [PATCH] CloseWindow action is totally unnecessary. It is only bound in Emacs keymap (to esc+esc), which works anyway thanks to DialogWrapper local shortcut bindings. --- .../ide/actions/CloseWindowAction.java | 68 ------------------- .../src/idea/Keymap_Default.xml | 1 - .../src/idea/Keymap_Eclipse.xml | 1 - .../src/idea/Keymap_Emacs.xml | 3 - .../src/idea/Keymap_Mac.xml | 1 - .../src/idea/Keymap_MacClassic.xml | 1 - .../src/idea/Keymap_Netbeans.xml | 1 - .../src/idea/PlatformActions.xml | 1 - 8 files changed, 77 deletions(-) delete mode 100644 platform/platform-impl/src/com/intellij/ide/actions/CloseWindowAction.java diff --git a/platform/platform-impl/src/com/intellij/ide/actions/CloseWindowAction.java b/platform/platform-impl/src/com/intellij/ide/actions/CloseWindowAction.java deleted file mode 100644 index 1d829fa4fc1f..000000000000 --- a/platform/platform-impl/src/com/intellij/ide/actions/CloseWindowAction.java +++ /dev/null @@ -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); - } -} diff --git a/platform/platform-resources/src/idea/Keymap_Default.xml b/platform/platform-resources/src/idea/Keymap_Default.xml index 3d9732ced32a..77adf06ef319 100644 --- a/platform/platform-resources/src/idea/Keymap_Default.xml +++ b/platform/platform-resources/src/idea/Keymap_Default.xml @@ -828,7 +828,6 @@ - diff --git a/platform/platform-resources/src/idea/Keymap_Eclipse.xml b/platform/platform-resources/src/idea/Keymap_Eclipse.xml index b19a504bf8cb..e585d9fbfcc1 100644 --- a/platform/platform-resources/src/idea/Keymap_Eclipse.xml +++ b/platform/platform-resources/src/idea/Keymap_Eclipse.xml @@ -30,7 +30,6 @@ - diff --git a/platform/platform-resources/src/idea/Keymap_Emacs.xml b/platform/platform-resources/src/idea/Keymap_Emacs.xml index 2f5751f4fee7..5f0ff589a373 100644 --- a/platform/platform-resources/src/idea/Keymap_Emacs.xml +++ b/platform/platform-resources/src/idea/Keymap_Emacs.xml @@ -1,8 +1,5 @@ - - - diff --git a/platform/platform-resources/src/idea/Keymap_Mac.xml b/platform/platform-resources/src/idea/Keymap_Mac.xml index 049ba15f5b20..a8a319d903d2 100644 --- a/platform/platform-resources/src/idea/Keymap_Mac.xml +++ b/platform/platform-resources/src/idea/Keymap_Mac.xml @@ -233,7 +233,6 @@ - diff --git a/platform/platform-resources/src/idea/Keymap_MacClassic.xml b/platform/platform-resources/src/idea/Keymap_MacClassic.xml index a1a4775e0c44..d23f2f894e60 100644 --- a/platform/platform-resources/src/idea/Keymap_MacClassic.xml +++ b/platform/platform-resources/src/idea/Keymap_MacClassic.xml @@ -237,7 +237,6 @@ - diff --git a/platform/platform-resources/src/idea/Keymap_Netbeans.xml b/platform/platform-resources/src/idea/Keymap_Netbeans.xml index a7202a2e2ced..1a492261665f 100644 --- a/platform/platform-resources/src/idea/Keymap_Netbeans.xml +++ b/platform/platform-resources/src/idea/Keymap_Netbeans.xml @@ -51,7 +51,6 @@ - diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 3fff505e0616..371afc7d3b2a 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -12,7 +12,6 @@ -