Search code examples
javaintellij-ideaintellij-14

IntelliJ Shouldn't Import * when Importing


Goal:

Say I have a line of code: payout.setPayoutStatusType(PayoutStatusType.REJECTED); but PayoutStatusType is not imported in the models which currently look like this:

import models.ApprovedLead;
import models.IdentityProviderType;
import models.ImportJob;
import models.ImportJobStatus;
import models.Offer;
import models.OfferSource;
import models.OfferViewedStatus;
import models.PaymentAccount;
import models.PaymentAccountType;
import models.PayoutStatusType;
import models.Payout;
import models.PendingPayout;
import models.RawOffer;
import models.User;
import models.UserDevice;
import models.UserDeviceType;
import models.UserOffer;

My issue is if I click on PayoutStatusType, and have it create the import for this it will remove all the static imports, and just do it in one line: import models.* which I don't want it to do.

My question is this: How do I set up my IDE which is Intellij to just make it import models.PayoutStatusType


Solution

  • You can configure the threshold above which IntelliJ starts to 'import *':

    Preferences > Editor > Code Style > Java > Imports > Class count to use import with '*'

    It looks like your latest import has exceeded this threshold thereby causing IntelliJ to collapse numerous imports under a *.