Cleanup (com.intellij.Patches and related usages)

This commit is contained in:
Roman Shevchenko
2012-07-05 12:24:16 +02:00
parent 00284beefc
commit cabf251005
6 changed files with 2293 additions and 2337 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -554,7 +554,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
myDebugProcessDispatcher.getMulticaster().connectorIsReady();
try {
if(SOCKET_ATTACHING_CONNECTOR_NAME.equals(connector.name()) && Patches.SUN_BUG_338675) {
if (SOCKET_ATTACHING_CONNECTOR_NAME.equals(connector.name()) && Patches.SUN_JDI_CONNECTOR_HANGUP_BUG) {
String portString = myConnection.getAddress();
String hostString = myConnection.getHostName();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -15,7 +15,6 @@
*/
package com.intellij.openapi.roots.ui.configuration;
import com.intellij.Patches;
import com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot;
import com.intellij.ide.util.projectWizard.importSources.JavaSourceRootDetectionUtil;
import com.intellij.openapi.module.Module;
@@ -84,9 +83,7 @@ public class JavaContentEntriesEditor extends CommonContentEntriesEditor {
}
final ProgressWindow progressWindow = new ProgressWindow(true, project);
final ProgressIndicator progressIndicator = Patches.MAC_HIDE_QUIT_HACK
? progressWindow
: new SmoothProgressAdapter(progressWindow, project);
final ProgressIndicator progressIndicator = new SmoothProgressAdapter(progressWindow, project);
final Runnable searchRunnable = new Runnable() {
public void run() {
@@ -146,7 +146,7 @@ public abstract class ChooseByNameBase {
if (myDisposedFlag && myPostponedOkAction != null && !myPostponedOkAction.isProcessed()) {
myPostponedOkAction.setRejected();
}
return myDisposedFlag;
}
@@ -315,7 +315,7 @@ public abstract class ChooseByNameBase {
updateProcessor.updatePopup(element);
}
}
public void repositionHint() {
if (myHint == null || !myHint.isVisible()) return;
PopupPositionManager.positionPopupInBestPosition(myHint, null, null);
@@ -356,11 +356,11 @@ public abstract class ChooseByNameBase {
final String checkBoxName = myModel.getCheckBoxName();
myCheckBox = new JCheckBox(checkBoxName != null ? checkBoxName + (myCheckBoxShortcut != null ? " (" + KeymapUtil.getShortcutsText(myCheckBoxShortcut.getShortcuts()) + ")" : "") : "");
myCheckBox.setAlignmentX(SwingConstants.RIGHT);
if (!SystemInfo.isMac) {
myCheckBox.setBorder(null);
}
myCheckBox.setSelected(myModel.loadInitialCheckBoxState());
if (checkBoxName == null) {
@@ -504,7 +504,7 @@ public abstract class ChooseByNameBase {
hideHint();
}
}
}, 5);
}, 5);
}
});
}
@@ -540,7 +540,7 @@ public abstract class ChooseByNameBase {
return;
}
final int keyCode;
// Add support for user-defined 'caret up/down' shortcuts.
KeyStroke stroke = KeyStroke.getKeyStrokeForEvent(e);
if (upShortcuts.contains(stroke)) {
@@ -685,7 +685,7 @@ public abstract class ChooseByNameBase {
}
return result;
}
private void hideHint() {
if (!myTextFieldPanel.focusRequested()) {
doClose(false);
@@ -712,7 +712,7 @@ public abstract class ChooseByNameBase {
});
}
}
private void updateDocumentation() {
final JBPopup hint = myTextFieldPanel.getHint();
final Object element = getChosenElement();
@@ -923,7 +923,7 @@ public abstract class ChooseByNameBase {
if (elements.isEmpty() && myTextFieldPanel != null) {
myTextFieldPanel.hideHint();
}
if (postRunnable != null) {
postRunnable.run();
}
@@ -1266,7 +1266,7 @@ public abstract class ChooseByNameBase {
@Override
protected void processKeyEvent(@NotNull KeyEvent e) {
final KeyStroke keyStroke = KeyStroke.getKeyStrokeForEvent(e);
if (myCompletionKeyStroke != null && keyStroke.equals(myCompletionKeyStroke)) {
completionKeyStrokeHappened = true;
e.consume();
@@ -1311,7 +1311,7 @@ public abstract class ChooseByNameBase {
super.processKeyEvent(e);
}
catch (NullPointerException e1) {
if (!Patches.SUN_BUG_6322854) {
if (!Patches.SUN_BUG_ID_6322854) {
throw e1;
}
}
@@ -1547,7 +1547,7 @@ public abstract class ChooseByNameBase {
}
protected boolean lastKeyStrokeIsCompletion() {
return myTextField.isCompletionKeyStroke();
return myTextField.isCompletionKeyStroke();
}
private static Matcher buildPatternMatcher(@NotNull String pattern) {
@@ -512,7 +512,7 @@ public class IdeEventQueue extends EventQueue {
return;
}
}
if (e instanceof InputEvent && Patches.SPECIAL_WINPUT_METHOD_PROCESSING) {
if (e instanceof InputEvent && Patches.SPECIAL_INPUT_METHOD_PROCESSING) {
final InputEvent inputEvent = (InputEvent)e;
if (!inputEvent.getComponent().isShowing()) {
return;
File diff suppressed because it is too large Load Diff
+33 -74
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -19,83 +19,60 @@ import com.intellij.openapi.util.SystemInfo;
@SuppressWarnings({"HardCodedStringLiteral", "UtilityClassWithoutPrivateConstructor"})
public class Patches {
public static final boolean ALL_FOLDERS_ARE_WRITABLE = SystemInfo.isWindows;
/**
* See sun bug parade.
* 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.JAVA_VERSION.indexOf("1.4.") != -1;
public static final boolean SUN_BUG_ID_4503845 = !SystemInfo.isJavaVersionAtLeast("1.4.1");
/**
* See sun bug parade [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4620537].
* MouseListener on JTabbedPane with SCROLL_TAB_LAYOUT policy doesn't get events. In the related bug
* #4499556 Sun advices to reimplement or hack JTabbedPane as workaround :)
* Debugger hangs on any attempt to attach/listen Connector when attach hanged once.
*/
public static final boolean SUN_BUG_ID_4620537 = SystemInfo.JAVA_VERSION.indexOf("1.4.") != -1;
/**
* See sun bug parade.
* Debugger hangs on any attempt to attach/listen Connector when attach hanged once.
*/
public static final boolean SUN_BUG_338675 = SystemInfo.JAVA_VERSION.indexOf("1.4.") != -1;
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_6322854 = SystemInfo.isLinux;
public static final boolean SUN_BUG_ID_6322854 = SystemInfo.isUnix && !SystemInfo.isMac;
/**
* See sun bug parade.
* 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.
*
* This bug is fixed in JDK1.5
*/
public static final boolean SUN_BUG_ID_4218084 = SystemInfo.JAVA_VERSION.indexOf("1.4.") != -1;
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 dialog and its content pane is being inserted
* 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.
* some internal references on focused component. It cause crash of dispatching of MOUSE_EXIT event.
*/
public static final boolean SPECIAL_WINPUT_METHOD_PROCESSING = SystemInfo.JAVA_VERSION.indexOf("1.4.") != -1;
public static final boolean SPECIAL_INPUT_METHOD_PROCESSING = !SystemInfo.isJavaVersionAtLeast("1.5");
/** BasicMenuUI$MenuKeyHandler.menuKeyPressed() incorrect for dynamic menus. */
public static final boolean SUN_BUG_ID_4738042 = SystemInfo.JAVA_VERSION.indexOf("1.4.") != -1 &&
SystemInfo.JAVA_VERSION.indexOf("1.4.2") == -1;
/**
* 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");
/** BasicTreeUI.FocusHandler doesn't properly repaint JTree on focus changes */
/**
* 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;
public static final boolean FILE_CHANNEL_TRANSFER_BROKEN = SystemInfo.isLinux && SystemInfo.OS_VERSION.startsWith("2.6");
private static final boolean BELOW_142DP2 = SystemInfo.isMac &&
(SystemInfo.JAVA_RUNTIME_VERSION.startsWith("1.4.0") ||
SystemInfo.JAVA_RUNTIME_VERSION.startsWith("1.4.1") ||
SystemInfo.JAVA_RUNTIME_VERSION.equals("1.4.2_03-117.1"));
private static final boolean DP2_OR_DP3 = SystemInfo.isMac && (
SystemInfo.JAVA_RUNTIME_VERSION.startsWith("1.4.2_03") ||
SystemInfo.JAVA_RUNTIME_VERSION.startsWith("1.4.2_04")
);
/**
* 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 = BELOW_142DP2;
/**
* A window that receives focus immediately receives focusLost() event and then focusGained() again.
*/
public static final boolean APPLE_BUG_ID_3716865 = DP2_OR_DP3;
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 = DP2_OR_DP3;
public static final boolean APPLE_BUG_ID_3716835 = SystemInfo.isMac && !SystemInfo.isJavaVersionAtLeast("1.4.2.5");
/**
* Use of JDK1.5 ReentrantReadWriteLock API eventually leads to JVM lock-up or core dump crashes.
@@ -105,50 +82,32 @@ public class Patches {
public static final boolean APPLE_BUG_ID_5359442 = SystemInfo.isMac && (!SystemInfo.isMacOSLeopard || !SystemInfo.isJavaVersionAtLeast("1.5.0_16"));
/**
* Lion eAWT FullScreen mode leads to visual artifacts
* Lion eAWT FullScreen mode leads to visual artifacts.
*/
public static final boolean APPLE_BUG_ID_10207064 =
SystemInfo.isMac && (!SystemInfo.isMacOSLeopard || !SystemInfo.isJavaVersionAtLeast("1.6.0_30"));
public static final boolean APPLE_BUG_ID_10207064 = SystemInfo.isMac && (!SystemInfo.isMacOSLeopard || !SystemInfo.isJavaVersionAtLeast("1.6.0_30"));
/**
* Minimizing and restoring application via View | Minimize leads to visual artifacts
* Minimizing and restoring application via View | Minimize leads to visual artifacts.
*/
public static final boolean APPLE_BUG_ID_10514018 = SystemInfo.isMac && !SystemInfo.isJavaVersionAtLeast("1.6.0_31");
/**
* Index out of bounds at apple.laf.AquaTabbedPaneUI.tabForCoordinate
* http://www.jetbrains.net/jira/browse/IDEADEV-15769
*/
public static final boolean MAC_AQUA_TABS_HACK = SystemInfo.isMac;
/**
* It happened on Mac that some thread did not suspended during VM suspend
* resuming VM in this case caused com.sun.jdi.InternalException #13
*/
public static final boolean MAC_RESUME_VM_HACK = SystemInfo.isMac;
/**
* IBM java machine 1.4.2 crashes if debugger uses ObjectReference.disableCollection() and ObjectReference.enableCollection()
* IBM java machine 1.4.2 crashes if debugger uses ObjectReference.disableCollection() and ObjectReference.enableCollection().
*/
public static final boolean IBM_JDK_DISABLE_COLLECTION_BUG = "false".equalsIgnoreCase(System.getProperty("idea.debugger.keep.temp.objects"));
public static final boolean MAC_HIDE_QUIT_HACK = false;
/**
* The corresponding bug (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4818143) is marked as fixed but it isn't really fixed.
* {@link java.awt.datatransfer.Clipboard#getContents(Object)} call may took 10 seconds if clipboard owner is not responding.
* See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4818143.
* The is marked as fixed but it actually isn't - {@link java.awt.datatransfer.Clipboard#getContents(Object)} call may hang
* for up to 10 seconds if clipboard owner is not responding.
*/
public static final boolean SLOW_GETTING_CLIPBOARD_CONTENTS = SystemInfo.isLinux || SystemInfo.isFreeBSD || SystemInfo.isMac;
public static final boolean SLOW_GETTING_CLIPBOARD_CONTENTS = SystemInfo.isUnix;
/**
* See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6209673.
* Huge int[] leak through VolatileImages cached in RepaintManager whenever screen configuration changes.
* For instance screen saver activates or computer goes hibernate. The problem still exists in 1.6 when two (or more)
* monitors exists
*/
public static final boolean SUN_BUG_ID_6209673 = SystemInfo.JAVA_RUNTIME_VERSION.startsWith("1.5") || SystemInfo.JAVA_RUNTIME_VERSION.startsWith("1.6");
/**
* Under Linux (Ubuntu) invoking "requestFocus" may (probably) activate inactive app. To investigate if it's really true.
*/
public static final boolean REQUEST_FOCUS_MAY_ACTIVATE_APP = SystemInfo.isLinux;
public static final boolean SUN_BUG_ID_6209673 = true;
}