protected final int getNextStep(int step) { ModuleWizardStep nextStep = null; final StepSequence stepSequence = getMode().getSteps(myWizardContext, null); if (stepSequence != null) { if (myRootStep == mySteps.get(step)) { return mySteps.indexOf(stepSequence.getCommonSteps().get(0)); } nextStep = stepSequence.getNextStep(mySteps.get(step)); while (nextStep != null && !nextStep.isStepVisible()) { nextStep = stepSequence.getNextStep(nextStep); } } return nextStep == null ? step : mySteps.indexOf(nextStep); }