private IStatus validateInputs(String... inputs) throws Exception { boolean[] result; result = MavenCoreUtils.serviceExists(inputs); final List<IStatus> statuses = new ArrayList<IStatus>(result.length); for (int i = 0; i < result.length; i++) { if (result[i] == true) { statuses.add( getBasicStatusModel( StringUtil.formatString(Messages.ERROR_SERVICE_ALREADY_EXIST, inputs[i]))); } } return statuses.isEmpty() ? Status.OK_STATUS : EclipseMessageUtils.createErrorMultiStatus( statuses, Messages.ERROR_SERVICE_VALIDATION_FAILED); }
/* (non-Javadoc) * @see org.ebayopensource.turmeric.eclipse.ui.wizards.pages.AbstractElementManagementWizardPage#dialogChanged() */ @Override public boolean dialogChanged() { if (super.dialogChanged() == false) return false; boolean addButtonEnabled = true; if (getPreviousPage() instanceof ComplexTypeCCWizardGeneralPage) { final ComplexTypeCCWizardGeneralPage ccPage = (ComplexTypeCCWizardGeneralPage) getPreviousPage(); if (ccPage.getRawBaseType() == null || StringUtils.isBlank(ccPage.getRawBaseType().toString())) { updatePageStatus( null, EclipseMessageUtils.createStatus( "The extension type of the previous page need to be selected in order to add elements", IStatus.WARNING)); addButtonEnabled = false; } } if (super.typesViewer != null) { super.typesViewer.setAddButtonsEnabled(addButtonEnabled); if (addButtonEnabled == false) return false; } final Set<String> elementNames = new HashSet<String>(); for (final IParameterElement elementModel : elements) { if (elementModel instanceof ElementTableModel) { final String elementValue = ((ElementTableModel) elementModel).getElementName(); final int minOccursValue = ((ElementTableModel) elementModel).getMinOccurs(); final int maxOccursValue = ((ElementTableModel) elementModel).getMaxOccurs(); if (!StringUtils.isAlphanumeric(elementValue)) { updateStatus(super.typesViewer.getControl(), "Element name should be alphanumeric"); return false; } if (minOccursValue < 0) { updateStatus(super.typesViewer.getControl(), "The min occurs must be greater than zero"); return false; } if (maxOccursValue != -1) { if (maxOccursValue >= 0 && minOccursValue > maxOccursValue) { updateStatus( super.typesViewer.getControl(), "The min occurs " + minOccursValue + " cannot be greater than max occurs " + maxOccursValue); return false; } } if (elementNames.contains(elementValue)) { updateStatus(super.typesViewer.getControl(), "Duplicate element name - " + elementValue); return false; } else { updateStatus(null); } elementNames.add(elementValue); } } return true; }