Project

General

Profile

« Previous | Next » 

Revision 40425911

Added by Katja Luther almost 4 years ago

avoid widget is disposed exception when clicking on finish and open

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonNodeWizardDialog.java
11 11
import org.eclipse.jface.dialogs.IDialogConstants;
12 12
import org.eclipse.jface.wizard.IWizard;
13 13
import org.eclipse.jface.wizard.WizardDialog;
14
import org.eclipse.swt.SWTException;
14 15
import org.eclipse.swt.events.SelectionEvent;
15 16
import org.eclipse.swt.events.SelectionListener;
16 17
import org.eclipse.swt.widgets.Button;
......
39 40
            @Override
40 41
            public void widgetSelected(SelectionEvent e) {
41 42
                ((NewTaxonNodeWizard)newTaxonNodeWizard).setOpenInEditor(true);
42
                finishPressed();
43
                try{
44
                    finishPressed();
45
                }catch(SWTException exception){
46
                    if ("Widget is disposed".equals(exception.getMessage())){
47
                        return;
48
                    }
49
                }
43 50
            }
44 51
            @Override
45 52
            public void widgetDefaultSelected(SelectionEvent e) {
......
51 58

  
52 59
    @Override
53 60
    public void updateButtons() {
61
        try{
62
            boolean canFinish = newTaxonNodeWizard.canFinish();
54 63

  
55
        boolean canFinish = newTaxonNodeWizard.canFinish();
64
            finishAndOpen.setEnabled(canFinish);
56 65

  
57
        finishAndOpen.setEnabled(canFinish);
58

  
59
        super.updateButtons();
60
     // finishAndOpen is default unless it is disabled and next is enabled
61
        if (canFinish) {
62
            getShell().setDefaultButton(finishAndOpen);
66
            super.updateButtons();
67
         // finishAndOpen is default unless it is disabled and next is enabled
68
            if (canFinish) {
69
                getShell().setDefaultButton(finishAndOpen);
70
            }
71
        }catch (SWTException e){
72
            if ("Widget is disposed".equals(e.getMessage())){
73
                return;
74
            }
63 75
        }
64 76
    }
65 77

  

Also available in: Unified diff