Project

General

Profile

« Previous | Next » 

Revision f81a5027

Added by Katja Luther over 2 years ago

ref #9730: fix enable/disable implementation of open button

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java
10 10

  
11 11
import java.io.IOException;
12 12

  
13
import org.apache.commons.lang.StringUtils;
14 13
import org.eclipse.core.runtime.IStatus;
15 14
import org.eclipse.core.runtime.Status;
16 15
import org.eclipse.swt.SWT;
......
33 32
public class UriWithLabelElement extends AbstractUriWithExceptionLabelElement<URI> {
34 33

  
35 34
    private Button btnOpenBrowser;
35
    private boolean isValidUri = false;
36 36

  
37 37
    protected UriWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString,
38 38
            URI initialObject, Integer textHeight, int style) {
......
81 81
            }
82 82
        });
83 83
        btnOpenBrowser.setLayoutData(LayoutConstants.RIGHT());
84
        if (StringUtils.isBlank(getText())){
85
            btnOpenBrowser.setEnabled(false);
86
        }
87

  
88 84
        initExceptionLabel(getLayoutComposite(), formFactory);
89 85
    }
90 86

  
......
93 89
        if(object != null){
94 90
            super.setText(object.toString());
95 91
        }
92

  
93

  
96 94
    }
97 95

  
98 96
    @Override
......
100 98
        String uriText = super.getText();
101 99
        if(uriText!=null){
102 100
            btnOpenBrowser.setEnabled(true);
103
            return new URI(super.getText());
101
            try{
102
                URI uri = new URI(super.getText());
103
                return uri;
104
            }catch (Exception e){
105
                btnOpenBrowser.setEnabled(false);
106
                throw e;
107
            }
104 108
        }else{
105 109
            btnOpenBrowser.setEnabled(false);
106 110
        	return null;

Also available in: Unified diff