diff --git a/platform/platform-api/src/com/intellij/ui/table/JBTable.java b/platform/platform-api/src/com/intellij/ui/table/JBTable.java index 9b6201ecf345..8a457e58bbf7 100644 --- a/platform/platform-api/src/com/intellij/ui/table/JBTable.java +++ b/platform/platform-api/src/com/intellij/ui/table/JBTable.java @@ -15,7 +15,6 @@ */ package com.intellij.ui.table; -import com.intellij.Patches; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.ExpirableRunnable; @@ -27,7 +26,8 @@ import com.intellij.util.ui.*; import org.jetbrains.annotations.NotNull; import javax.swing.*; -import javax.swing.event.*; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; import javax.swing.table.*; import java.awt.*; import java.awt.event.KeyEvent; @@ -115,10 +115,6 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component } }); - - //noinspection UnusedDeclaration - boolean marker = Patches.SUN_BUG_ID_4503845; // Don't remove. It's a marker for find usages - myUiUpdating = false; } diff --git a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java index 63b877be096c..dba143170334 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java @@ -15,7 +15,6 @@ */ package com.intellij.ide; -import com.intellij.Patches; import com.intellij.ide.dnd.DnDManager; import com.intellij.ide.dnd.DnDManagerImpl; import com.intellij.ide.plugins.PluginManager; @@ -532,12 +531,6 @@ public class IdeEventQueue extends EventQueue { return; } } - if (e instanceof InputEvent && Patches.SPECIAL_INPUT_METHOD_PROCESSING) { - final InputEvent inputEvent = (InputEvent)e; - if (!inputEvent.getComponent().isShowing()) { - return; - } - } if (e instanceof ComponentEvent && myWindowManager != null) { myWindowManager.dispatchComponentEvent((ComponentEvent)e); } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index 4ecb8df2118d..dc9cb4e76bd1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -15,7 +15,6 @@ */ package com.intellij.openapi.editor.impl; -import com.intellij.Patches; import com.intellij.application.options.OptionsConstants; import com.intellij.codeInsight.hint.DocumentFragmentTooltipRenderer; import com.intellij.codeInsight.hint.EditorFragmentComponent; @@ -247,7 +246,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi @Nullable private Color myForcedBackground = null; @Nullable private Dimension myPreferredSize; private int myVirtualPageHeight; - private Alarm myAppleRepaintAlarm; private final Alarm myMouseSelectionStateAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD); private Runnable myMouseSelectionStateResetRunnable; @@ -531,24 +529,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi Dimension preferredSize = getPreferredSize(); myEditorComponent.setSize(preferredSize); - if (Patches.APPLE_BUG_ID_3716835) { - myScrollingModel.addVisibleAreaListener(new VisibleAreaListener() { - @Override - public void visibleAreaChanged(VisibleAreaEvent e) { - if (myAppleRepaintAlarm == null) { - myAppleRepaintAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD); - } - myAppleRepaintAlarm.cancelAllRequests(); - myAppleRepaintAlarm.addRequest(new Runnable() { - @Override - public void run() { - repaint(0, myDocument.getTextLength()); - } - }, 50, ModalityState.stateForComponent(myEditorComponent)); - } - }); - } - updateCaretCursor(); // This hacks context layout problem where editor appears scrolled to the right just after it is created. @@ -920,8 +900,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi myEditorComponent.addKeyListener(new KeyAdapter() { @Override public void keyTyped(@NotNull KeyEvent event) { - if (Patches.APPLE_BUG_ID_3337563) - return; // Everything is going through InputMethods under MacOS X in JDK releases earlier than 1.4.2_03-117.1 if (event.isConsumed()) { return; } 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 0e840ee296de..46f66ed21dfb 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 @@ -15,7 +15,6 @@ */ package com.intellij.openapi.wm.impl; -import com.intellij.Patches; import com.intellij.ide.FrameStateManager; import com.intellij.ide.IdeEventQueue; import com.intellij.ide.actions.ActivateToolWindowAction; @@ -2083,9 +2082,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements @Override public void run() { try { - if (Patches.SPECIAL_INPUT_METHOD_PROCESSING) { - myFloatingDecorator.remove(myFloatingDecorator.getRootPane()); - } myFloatingDecorator.dispose(); } finally { diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java index b6aa7079fab6..4bb301ba7918 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java @@ -15,7 +15,6 @@ */ package com.intellij.openapi.wm.impl; -import com.intellij.Patches; import com.intellij.ide.AppLifecycleListener; import com.intellij.ide.DataManager; import com.intellij.ide.GeneralSettings; @@ -38,7 +37,6 @@ import com.intellij.openapi.wm.WindowManagerListener; import com.intellij.openapi.wm.ex.WindowManagerEx; import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeFrame; import com.intellij.ui.ScreenUtil; -import com.intellij.util.Alarm; import com.intellij.util.EventDispatcher; import com.intellij.util.messages.MessageBus; import com.intellij.util.ui.UIUtil; @@ -53,8 +51,6 @@ import java.awt.*; import java.awt.event.*; import java.awt.peer.ComponentPeer; import java.awt.peer.FramePeer; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -144,9 +140,6 @@ public final class WindowManagerImpl extends WindowManagerEx implements NamedCom myWindowWatcher = new WindowWatcher(); final KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); keyboardFocusManager.addPropertyChangeListener(FOCUSED_WINDOW_PROPERTY_NAME, myWindowWatcher); - if (Patches.SUN_BUG_ID_4218084) { - keyboardFocusManager.addPropertyChangeListener(FOCUSED_WINDOW_PROPERTY_NAME, new SUN_BUG_ID_4218084_Patch()); - } myLayout = new DesktopLayout(); myProject2Frame = new HashMap(); myDialogsToDispose = new HashMap>(); @@ -829,66 +822,6 @@ public final class WindowManagerImpl extends WindowManagerEx implements NamedCom return "WindowManager"; } - /** - * We cannot clear selected menu path just by changing of focused window. Under Windows LAF - * focused window changes sporadically when user clicks on menu item or sub-menu. The problem - * is that all popups under Windows LAF always has native window ancestor. This window isn't - * focusable but by mouse click focused window changes in this manner: - * InitialFocusedWindow->null - * null->InitialFocusedWindow - * To fix this problem we use alarm to accumulate such focus events. - */ - private static final class SUN_BUG_ID_4218084_Patch implements PropertyChangeListener { - private final Alarm myAlarm; - private Window myInitialFocusedWindow; - private Window myLastFocusedWindow; - private final Runnable myClearSelectedPathRunnable; - - public SUN_BUG_ID_4218084_Patch() { - myAlarm = new Alarm(); - myClearSelectedPathRunnable = new Runnable() { - @Override - public void run() { - if (myInitialFocusedWindow != myLastFocusedWindow) { - MenuSelectionManager.defaultManager().clearSelectedPath(); - } - } - }; - } - - @Override - public void propertyChange(final PropertyChangeEvent e) { - if (myAlarm.getActiveRequestCount() == 0) { - myInitialFocusedWindow = (Window)e.getOldValue(); - final MenuElement[] selectedPath = MenuSelectionManager.defaultManager().getSelectedPath(); - if (selectedPath.length == 0) { // there is no visible popup - return; - } - Component firstComponent = null; - for (final MenuElement menuElement : selectedPath) { - final Component component = menuElement.getComponent(); - if (component instanceof JMenuBar) { - firstComponent = component; - break; - } else if (component instanceof JPopupMenu) { - firstComponent = ((JPopupMenu) component).getInvoker(); - break; - } - } - if (firstComponent == null) { - return; - } - final Window window = SwingUtilities.getWindowAncestor(firstComponent); - if (window != myInitialFocusedWindow) { // focused window doesn't have popup - return; - } - } - myLastFocusedWindow = (Window)e.getNewValue(); - myAlarm.cancelAllRequests(); - myAlarm.addRequest(myClearSelectedPathRunnable, 150); - } - } - public WindowWatcher getWindowWatcher() { return myWindowWatcher; } diff --git a/platform/platform-impl/src/com/intellij/ui/plaf/beg/IdeaMenuUI.java b/platform/platform-impl/src/com/intellij/ui/plaf/beg/IdeaMenuUI.java index 3c5d79533585..0a6b107483d6 100644 --- a/platform/platform-impl/src/com/intellij/ui/plaf/beg/IdeaMenuUI.java +++ b/platform/platform-impl/src/com/intellij/ui/plaf/beg/IdeaMenuUI.java @@ -15,15 +15,12 @@ */ package com.intellij.ui.plaf.beg; -import com.intellij.Patches; import com.intellij.openapi.util.SystemInfo; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import javax.swing.*; import javax.swing.border.Border; -import javax.swing.event.MenuKeyEvent; -import javax.swing.event.MenuKeyListener; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicGraphicsUtils; import javax.swing.plaf.basic.BasicMenuUI; @@ -65,13 +62,6 @@ public class IdeaMenuUI extends BasicMenuUI{ } } - protected MenuKeyListener createMenuKeyListener(JComponent c){ - if (Patches.SUN_BUG_ID_4738042) { - return new SUN_BUG_ID_4738042_Patch(); - } - return super.createMenuKeyListener(c); - } - protected void installDefaults() { super.installDefaults(); Integer integer = UIUtil.getPropertyMaxGutterIconWidth(getPropertyPrefix()); @@ -413,104 +403,4 @@ public class IdeaMenuUI extends BasicMenuUI{ public void update(Graphics g, JComponent comp) { paint(g, comp); } - - /** - * Handles the mnemonic handling for the JMenu and JMenuItems. - */ - private final class SUN_BUG_ID_4738042_Patch implements MenuKeyListener { - private final boolean crossMenuMnemonic = UIUtil.isMenuCrossMenuMnemonics(); - - private JPopupMenu getActivePopupMenu(){ - MenuElement[] path = MenuSelectionManager.defaultManager(). - getSelectedPath(); - for (int i = path.length - 1; i >= 0; i--) { - MenuElement elem = path[i]; - if (elem instanceof JPopupMenu) { - return (JPopupMenu)elem; - } - } - return null; - } - - /** - * Opens the SubMenu - */ - public void menuKeyTyped(MenuKeyEvent e){ - if (!crossMenuMnemonic) { - JPopupMenu pm = getActivePopupMenu(); - if (pm != null && pm != menuItem.getParent()) { - return; - } - } - - int key = menuItem.getMnemonic(); - if (key == 0) - return; - MenuElement path[] = e.getPath(); - if (lower((char)key) == lower(e.getKeyChar())) { - JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu(); - MenuElement sub[] = popupMenu.getSubElements(); - if (sub.length > 0) { - MenuSelectionManager manager = e.getMenuSelectionManager(); - MenuElement newPath[] = new MenuElement[path.length + 2]; - System.arraycopy(path, 0, newPath, 0, path.length); - newPath[path.length] = popupMenu; - newPath[path.length + 1] = sub[0]; - manager.setSelectedPath(newPath); - } - e.consume(); - } - } - - /** - * Handles the mnemonics for the menu items. Will also handle duplicate mnemonics. - * Perhaps this should be moved into BasicPopupMenuUI. See 4670831 - */ - public void menuKeyPressed(MenuKeyEvent e){ - // Handle the case for Escape or Enter... - char keyChar = e.getKeyChar(); - if (!Character.isLetterOrDigit(keyChar)) - return; - - MenuSelectionManager manager = e.getMenuSelectionManager(); - MenuElement selectedPath[] = manager.getSelectedPath(); - - for (int i = selectedPath.length - 1; i >= 0; i--) { - if (selectedPath[i] == menuItem) { - JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu(); - MenuElement items[] = popupMenu.getSubElements(); - - int index = -1; - - for (int j = 0; j < items.length; j++) { - int key = ((JMenuItem)items[j]).getMnemonic(); - if (Character.toLowerCase((char)key) == Character.toLowerCase(keyChar)) { - index = j; - break; - } - } - - if (index != -1) { - // Invoke the menu action - JMenuItem item = (JMenuItem)items[index]; - if (!(item instanceof JMenu)) { - // Let Submenus be handled by menuKeyTyped - manager.clearSelectedPath(); - item.doClick(); - } - } - - e.consume(); - return; - } - } - } - - public void menuKeyReleased(MenuKeyEvent e){ - } - - private char lower(char keyChar){ - return Character.toLowerCase(keyChar); - } - } } diff --git a/platform/util/src/com/intellij/Patches.java b/platform/util/src/com/intellij/Patches.java index 5efb6916ffc4..cb1c9c07347d 100644 --- a/platform/util/src/com/intellij/Patches.java +++ b/platform/util/src/com/intellij/Patches.java @@ -21,61 +21,18 @@ import java.awt.*; @SuppressWarnings({"HardCodedStringLiteral", "UtilityClassWithoutPrivateConstructor"}) public class Patches { - /** - * See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4503845. - * When JTable loses focus it cancel cell editing. It should stop cell editing instead. - * Actually SUN-boys told they have fixed the bug, but they cancel editing instead of stopping it. - */ - public static final boolean SUN_BUG_ID_4503845 = !SystemInfo.isJavaVersionAtLeast("1.4.1"); - - /** - * Debugger hangs on any attempt to attach/listen Connector when attach hanged once. - */ - public static final boolean SUN_JDI_CONNECTOR_HANGUP_BUG = !SystemInfo.isJavaVersionAtLeast("1.5"); - /** * See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6322854. * java.lang.NullPointerException: Failed to retrieve atom name. */ public static final boolean SUN_BUG_ID_6322854 = SystemInfo.isXWindow; - /** - * See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4218084. - * If you invoke popup menu, then click on a different window (JFrame, JDialog. It doesn't matter), - * the JPopupMenu in the previous window still has focus, as does the new window. - * Seems like focus in two locations at the same time. - */ - public static final boolean SUN_BUG_ID_4218084 = !SystemInfo.isJavaVersionAtLeast("1.5"); - - /** - * JDK 1.3.x and 1.4.x has the following error: when we close a dialog and its content pane is being inserted - * into another dialog and mouse WAS INSIDE of dialog's content pane then the AWT doesn't change - * some internal references on focused component. It cause crash of dispatching of MOUSE_EXIT event. - */ - public static final boolean SPECIAL_INPUT_METHOD_PROCESSING = !SystemInfo.isJavaVersionAtLeast("1.5"); - - /** - * See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4738042. - * BasicMenuUI$MenuKeyHandler.menuKeyPressed() incorrect for dynamic menus. - */ - public static final boolean SUN_BUG_ID_4738042 = !SystemInfo.isJavaVersionAtLeast("1.4.2"); - /** * See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4893787. * BasicTreeUI.FocusHandler doesn't properly repaint JTree on focus changes. */ public static final boolean SUN_BUG_ID_4893787 = true; - /** - * Every typing produces InputMethodEvent instead of KeyEvent with keyTyped event code. Fixed in JRE higher than 1.4.2_03-117.1 - */ - public static final boolean APPLE_BUG_ID_3337563 = SystemInfo.isMac && !SystemInfo.isJavaVersionAtLeast("1.4.2.3.117.1"); - - /** - * Incorrect repaint of the components wrapped with JScrollPane. - */ - public static final boolean APPLE_BUG_ID_3716835 = SystemInfo.isMac && !SystemInfo.isJavaVersionAtLeast("1.4.2.5"); - /** * Minimizing and restoring application via View | Minimize leads to visual artifacts. */