Dimension () { int maxWidth = -1; int maxHeight = -1; for (IntentionActionWithTextCaching action : myCachedIntentions.getAllActions()) { if (!action.isShowIcon()) continue; Icon icon = myCachedIntentions.getIcon(action); if (icon == null || icon instanceof EmptyIcon) continue; maxWidth = Math.max(maxWidth, icon.getIconWidth()); maxHeight = Math.max(maxHeight, icon.getIconHeight()); } return new Dimension(maxWidth, maxHeight); }