Java Code Examples for org.eclipse.jface.wizard.WizardPage#WARNING

The following examples show how to use org.eclipse.jface.wizard.WizardPage#WARNING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewOb2ModulePage.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private boolean validatePage() {
    String err = null;
    int    errType = WizardPage.ERROR;
    try {
        if (rootContainer == null) {
            err = Messages.NewOb2ModulePage_CantCreateNoXdsProject;
            return false;
        }
        if (StringUtils.isBlank(moduleName)) {
            err = Messages.NewOb2ModulePage_EnterModuleName;
            errType = WizardPage.WARNING;
            return false;
        }
        
        if (!isValidName(moduleName)) {
            err = Messages.NewOb2ModulePage_ModNameInvalid;
            return false;
        }
        
        if (checkExist(sourceFolder, moduleName + ".ob2") ) { //$NON-NLS-1$
            err = String.format(Messages.NewOb2ModulePage_ModuleExists, moduleName + ".ob2", sourceFolder); //$NON-NLS-2$
            return false;
        }

    }
    finally {
        setMessage(err, errType);
    }
    return true;
}
 
Example 2
Source File: NewProjectFromScratchPage.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Returns whether this page's controls currently all contain valid 
 * values.
 *
 * @return <code>true</code> if all controls are valid, and
 *   <code>false</code> if at least one is invalid
 */
private boolean validatePage() {
    int    errType = WizardPage.ERROR;
    String err     = null;

    try {
        // SDK:
        if (!projectSdk.isValid()) {
            throw new ValidationException(projectSdk.getErrorMessage(), true);
        }

        validateEclipseProjectAndLocation(projectName, projectRoot, false);

        // Prj:
        if (createPrj) {
            // Prj name:
            if (prjName.isEmpty()) {
                throw new ValidationException(Messages.NewProjectFromScratchPage_EnterXdsPrjFileName, true);
            }
        }

        // Create Main module:
        if (createMain) {
            if (mainModule.isEmpty()) {
                throw new ValidationException(Messages.NewProjectFromScratchPage_EnterMainModuleName, false);
            } else {
                String s = checkMainName(mainModule);
                if (s != null) {
                    throw new ValidationException(s, true);
                }
            }
        }

        if (!createPrj && !createMain) {
            throw new ValidationException(Messages.NewProjectFromScratchPage_PrjForMainModuleShouldBeSpecified, true);
        }

    } catch (ValidationException e) {
        err = e.getMessage();
        errType = e.isError() ? WizardPage.ERROR : WizardPage.WARNING;
    }

    setMessage(err, errType);

    return err==null;
}
 
Example 3
Source File: NewModulePage.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
private boolean validatePage() {
    String err = null;
    int    errType = WizardPage.ERROR;
    try {
        if (rootContainer == null) {
            err = Messages.NewModulePage_CantWhenNoXdsProject;
            return false;
        }
        if (StringUtils.isBlank(moduleName)) {
            err = Messages.NewModulePage_ModuleNameRequired;
            errType = WizardPage.WARNING;
            return false;
        }
        
        if (!isValidName(moduleName)) {
            err = Messages.NewModulePage_ModuleNameInvalid;
            return false;
        }
        
        if (cboxDefinitionModule.getSelection()) {
            if (StringUtils.isBlank(definitionModuleSourceFolder)) {
                err = Messages.NewModulePage_NoDefName;
                return false;
            }
            
            if (checkExist(definitionModuleSourceFolder, moduleName + ".def") ) { //$NON-NLS-1$
                err = String.format(Messages.NewModulePage_DefAlreadyExists, moduleName + ".def", definitionModuleSourceFolder); //$NON-NLS-1$
                return false;
            }
        }
        
        if (cboxImplementationModule.getSelection()) {
            if (StringUtils.isBlank(implementationModuleSourceFolder)) {
                err = Messages.NewModulePage_NoImplName;
                return false;
            }
            
            if (checkExist(implementationModuleSourceFolder, moduleName + ".mod") ) { //$NON-NLS-1$
                err = String.format(Messages.NewModulePage_ImplAlreadyExists, moduleName + ".mod", implementationModuleSourceFolder); //$NON-NLS-1$
                return false;
            }
        }
        
        if (!cboxDefinitionModule.getSelection() && !cboxImplementationModule.getSelection()) {
            err = Messages.NewModulePage_DefOrImplShouldBeSpecified;
            return false;
        }
    }
    finally {
        setMessage(err, errType);
    }
    return true;
}