Source:
<code>private void createLocalSourceControls(DataBindingContext dbc, Group sourceGroup) { Label label = new Label(sourceGroup, SWT.NONE); GridDataFactory.fillDefaults().span(3, 1).applyTo(label); label.setText("Enter a file path (workspace or local) or a full URL"); Text sourceText = new Text(sourceGroup, SWT.BORDER); GridDataFactory.fillDefaults() .align(SWT.FILL, SWT.CENTER).grab(true, false) .applyTo(sourceText); final IObservableValue source = WidgetProperties.text(SWT.Modify).observe(sourceText); Binding binding = ValueBindingBuilder .bind(source ) .to(BeanProperties.value( IResourcePayloadPageModel.PROPERTY_SOURCE).observe(model)) .in(dbc); MultiValidator validator = new MultiValidator() { @Override protected IStatus validate() { String sourceValue = (String) source.getValue(); <START> return (boolean) !IResourcePayloadPageModel.URL_VALIDATOR.isValid(sourceValue) && !isFile(sourceValue)?ValidationStatus.error(sourceValue + " is not a file"):ValidationStatus.ok(); <END> } }; dbc.addValidationStatusProvider(validator); Button btnBrowseFiles = new Button(sourceGroup, SWT.NONE); btnBrowseFiles.setText("File system..."); GridDataFactory.fillDefaults() .align(SWT.LEFT, SWT.CENTER) .applyTo(btnBrowseFiles); UIUtils.setDefaultButtonWidth(btnBrowseFiles); btnBrowseFiles.addSelectionListener(onFileSystemBrowseClicked()); Button btnBrowseWorkspaceFiles = new Button(sourceGroup, SWT.NONE); btnBrowseWorkspaceFiles.setText("Workspace..."); GridDataFactory.fillDefaults() .align(SWT.LEFT, SWT.CENTER) .applyTo(btnBrowseWorkspaceFiles); UIUtils.setDefaultButtonWidth(btnBrowseWorkspaceFiles); btnBrowseWorkspaceFiles.addSelectionListener(onBrowseWorkspaceClicked()); }</code><technical_language>check for empty sourceValue treat this case separately dont want show error opening dialog ![image](<LINK_0></technical_language>

Target:
private void createLocalSourceControls(DataBindingContext dbc, Group sourceGroup) { Label label = new Label(sourceGroup, SWT.NONE); GridDataFactory.fillDefaults().span(3, 1).applyTo(label); label.setText("Enter a file path (workspace or local) or a full URL."); Text sourceText = new Text(sourceGroup, SWT.BORDER); GridDataFactory.fillDefaults() .align(SWT.FILL, SWT.CENTER).grab(true, false) .applyTo(sourceText); final IObservableValue source = WidgetProperties.text(SWT.Modify).observe(sourceText); Binding binding = ValueBindingBuilder .bind(source ) .to(BeanProperties.value( IResourcePayloadPageModel.PROPERTY_SOURCE).observe(model)) .in(dbc); MultiValidator validator = new MultiValidator() { @Override protected IStatus validate() { String sourceValue = (String) source.getValue(); if (StringUtils.isEmpty(sourceValue)) { return ValidationStatus.cancel("You need to provide a file path or an URL"); } return (boolean) !IResourcePayloadPageModel.URL_VALIDATOR.isValid(sourceValue) && !isFile(sourceValue)?ValidationStatus.error(sourceValue + " is not a file"):ValidationStatus.ok(); } }; dbc.addValidationStatusProvider(validator); ControlDecorationSupport.create( validator, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater()); Button btnBrowseFiles = new Button(sourceGroup, SWT.NONE); btnBrowseFiles.setText("Browse File System..."); GridDataFactory.fillDefaults() .align(SWT.LEFT, SWT.CENTER) .applyTo(btnBrowseFiles); btnBrowseFiles.addSelectionListener(onFileSystemBrowseClicked()); Button btnBrowseWorkspaceFiles = new Button(sourceGroup, SWT.NONE); btnBrowseWorkspaceFiles.setText("Browse Workspace..."); GridDataFactory.fillDefaults() .align(SWT.LEFT, SWT.CENTER) .applyTo(btnBrowseWorkspaceFiles); btnBrowseWorkspaceFiles.addSelectionListener(onBrowseWorkspaceClicked()); }