From a86746b8d0efb65044f4bf0aa3ee8ec255e3d40f Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Tue, 18 Nov 2014 14:28:34 +0100 Subject: [PATCH] hide gear when no actions available (e.g. File size exceed configured limit) --- .../impl/FileLevelIntentionComponent.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/FileLevelIntentionComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/FileLevelIntentionComponent.java index 3fcb65cbc340..cbba8a6c5e68 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/FileLevelIntentionComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/FileLevelIntentionComponent.java @@ -80,26 +80,27 @@ public class FileLevelIntentionComponent extends EditorNotificationPanel { if (gutterMark != null) { myLabel.setIcon(gutterMark.getIcon()); } - myGearLabel.setIcon(AllIcons.General.Gear); - new ClickListener() { - @Override - public boolean onClick(@NotNull MouseEvent e, int clickCount) { - IntentionListStep step = new IntentionListStep(null, editor, psiFile, project); - if (intentions != null && !intentions.isEmpty()) { + if (intentions != null && !intentions.isEmpty()) { + myGearLabel.setIcon(AllIcons.General.Gear); + + new ClickListener() { + @Override + public boolean onClick(@NotNull MouseEvent e, int clickCount) { + IntentionListStep step = new IntentionListStep(null, editor, psiFile, project); HighlightInfo.IntentionActionDescriptor descriptor = intentions.get(0).getFirst(); IntentionActionWithTextCaching actionWithTextCaching = step.wrapAction(descriptor, psiFile, psiFile, editor); if (step.hasSubstep(actionWithTextCaching)) { step = step.getSubStep(actionWithTextCaching, null); } + ListPopup popup = JBPopupFactory.getInstance().createListPopup(step); + Dimension dimension = popup.getContent().getPreferredSize(); + Point at = new Point(-dimension.width + myGearLabel.getWidth(), FileLevelIntentionComponent.this.getHeight()); + popup.show(new RelativePoint(e.getComponent(), at)); + return true; } - ListPopup popup = JBPopupFactory.getInstance().createListPopup(step); - Dimension dimension = popup.getContent().getPreferredSize(); - Point at = new Point(-dimension.width + myGearLabel.getWidth(), FileLevelIntentionComponent.this.getHeight()); - popup.show(new RelativePoint(e.getComponent(), at)); - return true; - } - }.installOn(myGearLabel); + }.installOn(myGearLabel); + } } @Override