/** * Validates the current input. */ private void validateInput() { final String alertId = alertIDText.getText().trim(); alert = StringUtils.isEmpty(alertId) ? null : availableAlerts.get(alertId); // NOPMD if (null == alert) { okButton.setEnabled(false); if (StringUtils.isEmpty(alertId)) { AlertSelectionDialog.this.setMessage("No alert id specified!", IMessageProvider.ERROR); } else { AlertSelectionDialog.this.setMessage("There is no alert with id '" + alertId + "'!", IMessageProvider.ERROR); } } else { okButton.setEnabled(true); AlertSelectionDialog.this.setMessage( "Selected alert:\n" + TextFormatter.getAlertDescription(alert), IMessageProvider.INFORMATION); } }
/** * Creates {@link InputDefinition} for Alert-Invocations view. * * @param cmrRepository * CMR Repository definition. * @param alert * The alert. * @return The {@link InputDefinition} instance. */ private InputDefinition createInputDefinition(CmrRepositoryDefinition cmrRepository, Alert alert) { InputDefinition inputDefinition = new InputDefinition(); inputDefinition.setRepositoryDefinition(cmrRepository); AlertInputDefinitionExtra alertInputExtra = new AlertInputDefinitionExtra(); alertInputExtra.setAlert(alert); inputDefinition.addInputDefinitonExtra(InputDefinitionExtrasMarkerFactory.ALERT_EXTRAS_MARKER, alertInputExtra); inputDefinition.setId(SensorTypeEnum.ALERT_INVOCATION); EditorPropertiesData editorPropertiesData = new EditorPropertiesData(); editorPropertiesData.setSensorImage(SensorTypeEnum.ALERT_INVOCATION.getImage()); editorPropertiesData.setSensorName("Alert Invocation Sequences"); editorPropertiesData.setViewImage(ImageFormatter.getAlertImage(alert)); editorPropertiesData.setViewName(TextFormatter.getAlertDescription(alert)); inputDefinition.setEditorPropertiesData(editorPropertiesData); IdDefinition idDefinition = new IdDefinition(); idDefinition.setPlatformId(0); inputDefinition.setIdDefinition(idDefinition); return inputDefinition; }