int (final int step) { ModuleWizardStep nextStep = null; final StepSequence stepSequence = getSequence(); if (stepSequence != null) { ModuleWizardStep current = mySteps.get(step); if (isStepWithNotCompletedSubSteps(current)) { return step; } nextStep = stepSequence.getNextStep(current); while (nextStep != null && !nextStep.isStepVisible()) { nextStep = stepSequence.getNextStep(nextStep); } } return nextStep == null ? step : mySteps.indexOf(nextStep); }