public java.util.Map<String, IStatus> validate(Object value, Object context) { Map<String, IStatus> errors = NO_ERRORS; if (value == null || "".equals(value)) { // $NON-NLS-1$ errors = createErrormessage( new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_NOT_CONFIGURED)); } else { SeamRuntime rt = SeamRuntimeManager.getInstance().findRuntimeByName(value.toString()); if (rt == null) { errors = createErrormessage( new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_CANNOT_BE_FOUND, value))); } else if (!new File(rt.getHomeDir()).exists()) { errors = createErrormessage( new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_DOES_NOT_EXIST, value))); } else if (!new File(rt.getSeamGenDir()).exists()) { errors = createErrormessage( new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages .VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_DOES_NOT_EXIST, value))); } else if (!new File(rt.getSrcTemplatesDir()).exists()) { errors = createErrormessage( new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages .VALIDATOR_FACTORY_SEAM_RT_SOURCE_TEMPLATES_DIR_DOES_NOT_EXIST, value))); } else if (!new File(rt.getViewTemplatesDir()).exists()) { errors = createErrormessage( new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages .VALIDATOR_FACTORY_SEAM_RT_VIE_TEMPLATE_DIR_DOES_NOT_EXIST, value))); // } else if(!new // File(rt.getResourceTemplatesDir()).exists()) { // errors = createErrormessage(NLS.bind( // "Seam Runtime '{0)' resource templates directory doesn't exist for selected Seam // Web Project" // ,value)); } } return errors; }
public Map<String, IStatus> validate(Object value, Object context) { Map<String, IStatus> errors = NO_ERRORS; if (value == null || "".equals(value.toString().trim())) { // $NON-NLS-1$ errors = createErrormessage( ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RUNTIME_IS_NOT_SELECTED)); } else { SeamRuntime rt = SeamRuntimeManager.getInstance().findRuntimeByName(value.toString()); if (rt == null) { errors = createErrormessage( ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages.VALIDATOR_FACTORY_CANNOT_FIND_SEAM_RUNTIME, value))); } else if (!new File(rt.getHomeDir()).exists()) { errors = createErrormessage( ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_IS_MISSING, value))); } else if (!new File(rt.getSeamGenDir()).exists()) { errors = createErrormessage( ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_IS_MISSING, value))); } else if (!new File(rt.getSrcTemplatesDir()).exists()) { errors = createErrormessage( ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_SRC_DIR_IS_MISSING, value))); } else if (!new File(rt.getViewTemplatesDir()).exists()) { errors = createErrormessage( ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_VIEW_DIR_IS_MISSING, value))); } else if (!new File(rt.getResourceTemplatesDir()).exists()) { errors = createErrormessage( ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, new Status( IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, NLS.bind( SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_RESOURCES_DIR_IS_MISSING, value))); } } return errors; }