void updateStatus() { getEnteredValues(); boolean ok = false; if (StringHelper.isEmpty(getPropertyName())) { setMessage( HibernateConsoleMessages.AddPropertyDialog_the_property_name_must_be_chosen_or_entered, IMessageProvider.ERROR); } else if (getPropertyName().indexOf(' ') >= 0 || getPropertyName().indexOf('\t') >= 0) { setMessage( HibernateConsoleMessages.AddPropertyDialog_the_property_name_may_not_contain_whitespaces, IMessageProvider.ERROR); } else if (StringHelper.isEmpty(getPropertyValue())) { setMessage( HibernateConsoleMessages.AddPropertyDialog_the_property_value_must_be_non_empty, IMessageProvider.ERROR); } else { if (!flagEdit && ef.hasLocalValueFor(getPropertyName())) { String out = NLS.bind( HibernateConsoleMessages.AddPropertyDialog_the_property_is_already_set, getPropertyName()); setMessage(out, IMessageProvider.WARNING); } else { setMessage(null, IMessageProvider.ERROR); } ok = true; } Button button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(ok); } }
public boolean preLaunchCheck( ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { ExporterAttributes attributes = new ExporterAttributes(configuration); String configName = attributes.getConsoleConfigurationName(); if (StringHelper.isEmpty(configName)) { abort( HibernateConsoleMessages .CodeGenerationLaunchDelegate_console_configuration_name_is_empty_in + configuration.getName(), null, ICodeGenerationLaunchConstants.ERR_UNSPECIFIED_CONSOLE_CONFIGURATION); } if (KnownConfigurations.getInstance().find(configName) == null) { String out = NLS.bind( HibernateConsoleMessages .CodeGenerationLaunchDelegate_console_configuration_not_found_in, configName, configuration.getName()); abort(out, null, ICodeGenerationLaunchConstants.ERR_CONSOLE_CONFIGURATION_NOTFOUND); } if (StringHelper.isEmpty(attributes.getOutputPath())) { abort( HibernateConsoleMessages.CodeGenerationLaunchDelegate_output_has_to_be_specified_in + configuration.getName(), null, ICodeGenerationLaunchConstants.ERR_OUTPUT_PATH_NOTFOUND); } List<ExporterFactory> exporterFactories = attributes.getExporterFactories(); for (Iterator<ExporterFactory> iter = exporterFactories.iterator(); iter.hasNext(); ) { ExporterFactory exFactory = iter.next(); if (exFactory.isEnabled(configuration) && exFactory .getExporterDefinitionId() .equals("org.hibernate.tools.query")) { // $NON-NLS-1$ if (!exFactory.getProperties().containsKey("query_string")) { // $NON-NLS-1$ abort( "Query property should be explicitly set for Query Exporter", null, ICodeGenerationLaunchConstants.ERR_OUTPUT_PATH_NOTFOUND); // $NON-NLS-1$ } } } return super.preLaunchCheck(configuration, mode, monitor); }