From 2bc2ecc15d6b7fef8d5d27c84f41513d3fc6071e Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 2 Mar 2012 16:45:42 +0100 Subject: [PATCH] auto-import doesn't hide parameter info (PY-5764) --- .../daemon/impl/quickfix/ImportClassFixBase.java | 4 ++-- .../codeInsight/daemon/impl/ShowIntentionsPass.java | 4 ++-- .../codeInsight/folding/impl/CodeFoldingManagerImpl.java | 4 ++-- .../src/com/intellij/codeInsight/hint/HintManager.java | 4 ++-- .../com/intellij/codeInsight/hint/HintManagerImpl.java | 8 ++++++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java index ee4b5eae23a9..240c852bd404 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java @@ -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. @@ -200,7 +200,7 @@ public abstract class ImportClassFixBase im if (doShow && canImportHere) { String hintText = ShowAutoImportPass.getMessage(classes.length > 1, classes[0].getQualifiedName()); - if (!ApplicationManager.getApplication().isUnitTestMode() && !HintManager.getInstance().hasShownHintsThatWillHideByOtherHint()) { + if (!ApplicationManager.getApplication().isUnitTestMode() && !HintManager.getInstance().hasShownHintsThatWillHideByOtherHint(true)) { HintManager.getInstance().showQuestionHint(editor, hintText, myRef.getTextOffset(), myRef.getTextRange().getEndOffset(), action); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java index 5bcb9bd50dd5..e90c7b8589b5 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java @@ -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. @@ -142,7 +142,7 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass { if (!visibleArea.contains(xy)) return; TemplateState state = TemplateManagerImpl.getTemplateState(myEditor); - if (myShowBulb && (state == null || state.isFinished()) && !HintManager.getInstance().hasShownHintsThatWillHideByOtherHint()) { + if (myShowBulb && (state == null || state.isFinished()) && !HintManager.getInstance().hasShownHintsThatWillHideByOtherHint(false)) { DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(myProject); codeAnalyzer.setLastIntentionHint(myProject, myFile, myEditor, myIntentionsInfo, myHasToRecreate); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java index fcb172b585cc..92e4f5bdc96a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 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. @@ -88,7 +88,7 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec public void mouseMoved(EditorMouseEvent e) { if (myProject.isDisposed()) return; HintManager hintManager = HintManager.getInstance(); - if (hintManager != null && hintManager.hasShownHintsThatWillHideByOtherHint()) { + if (hintManager != null && hintManager.hasShownHintsThatWillHideByOtherHint(false)) { return; } diff --git a/platform/platform-api/src/com/intellij/codeInsight/hint/HintManager.java b/platform/platform-api/src/com/intellij/codeInsight/hint/HintManager.java index 8920ab108070..4c39ca3f6170 100644 --- a/platform/platform-api/src/com/intellij/codeInsight/hint/HintManager.java +++ b/platform/platform-api/src/com/intellij/codeInsight/hint/HintManager.java @@ -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. @@ -73,5 +73,5 @@ public abstract class HintManager { public abstract void hideAllHints(); - public abstract boolean hasShownHintsThatWillHideByOtherHint(); + public abstract boolean hasShownHintsThatWillHideByOtherHint(boolean willShowTooltip); } diff --git a/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java b/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java index 4f5719558f1b..1ccbe4cee930 100644 --- a/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java @@ -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. @@ -192,10 +192,14 @@ public class HintManagerImpl extends HintManager implements Disposable { } } - public boolean hasShownHintsThatWillHideByOtherHint() { + public boolean hasShownHintsThatWillHideByOtherHint(boolean willShowTooltip) { LOG.assertTrue(SwingUtilities.isEventDispatchThread()); for (HintInfo hintInfo : myHintsStack) { if (hintInfo.hint.isVisible() && (hintInfo.flags & HIDE_BY_OTHER_HINT) != 0) return true; + if (willShowTooltip && hintInfo.hint.isAwtTooltip()) { + // only one AWT tooltip can be visible, so this hint will hide even though it's not marked with HIDE_BY_OTHER_HINT + return true; + } } return false; }