This discussion is archived
1 Reply Latest reply: Jan 16, 2013 8:16 AM by gimbal2 RSS

org.eclipse.swt.SWTException: Widget is disposed

mjmjava Newbie
Currently Being Moderated
Hello ,
I am using SWT for creating UI , I am written following code for creating pop up window

Button ok = componentsRenderer.createButtonWidget(versionTreeComponentsShell, SWT.PUSH,
                    PropertyClass.getPropertyLabel(QTLConstants.OK_BUTTON));
          Button cancel = componentsRenderer.createButtonWidget(versionTreeComponentsShell, SWT.PUSH,
                    PropertyClass.getPropertyLabel(QTLConstants.CANCEL_BUTTON));
          ok.addSelectionListener(new SelectionAdapter() {
          @Override
               public void widgetSelected(SelectionEvent e) {
               StringBuffer sbDefaultVersionSplitter = new StringBuffer();
               String defaultVersionSplitterSelected = "";
                    if(versionSplitterCheckBoxList.size() > 0){
                         String[] defaultVersionSplitters = PropertyClass.getPropertyLabel(QTLConstants.VERSIONING_ASSISTENT_PAGE_SPLLITER).split(QTLConstants.MULTIPLE_EXTENSIONS_SPLITER);
                         for(Button cbButton : versionSplitterCheckBoxList){
                              if(cbButton.getSelection() && !cbButton.getText().equalsIgnoreCase(defaultVersionSplitters[3])){
                                   // check is added for version number string equal to "<fileName><number>" i.e splitter is not present
                                   if(!cbButton.getText().equalsIgnoreCase(defaultVersionSplitters[2])){
                                        String tempVersionStringWithSplitter = cbButton.getText().substring(cbButton.getText().indexOf("_")+1,cbButton.getText().length());                                   
                                        String selectedSplitter = tempVersionStringWithSplitter.substring(0,tempVersionStringWithSplitter.indexOf("<"));                              
                                        
                                        sbDefaultVersionSplitter.append(selectedSplitter);
                                        sbDefaultVersionSplitter.append("|");
                                   }
                              }
                         }//end of for loop
                         if(customVersionSplitterText.isEnabled() && customVersionSplitterText.getCharCount() > 0){
                              sbDefaultVersionSplitter.append(customVersionSplitterText.getText());
                              defaultVersionSplitterSelected = sbDefaultVersionSplitter.toString();
                         } else if(sbDefaultVersionSplitter.length() > 0 && (!customVersionSplitterText.isEnabled() || customVersionSplitterText.getCharCount() == 0)){
                              defaultVersionSplitterSelected = sbDefaultVersionSplitter.toString().substring(0, sbDefaultVersionSplitter.length()-2);
                         }
                    }//end of if loop
                    dataBean.setVersionSplitterSelected(defaultVersionSplitterSelected);                    
                    versionTreeComponentsShell.close();     
                    }
          });
          cancel.addSelectionListener(new SelectionAdapter() {
               @Override
               public void widgetSelected(SelectionEvent e) {               
                    versionTreeComponentsShell.setVisible(false);                    
               }
          });


when i am clicking multiple time on "OK" button i am getting following error

org.eclipse.swt.SWTException: Widget is disposed
     at org.eclipse.swt.SWT.error(SWT.java:4361)
     at org.eclipse.swt.SWT.error(SWT.java:4276)
     at org.eclipse.swt.SWT.error(SWT.java:4247)
     at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
     at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:340)
     at org.eclipse.swt.widgets.Button.getSelection(Button.java:721)
     at com.impact.qtl12.imports.UI.CSVWizard.FileInputPage$10.widgetSelected(FileInputPage.java:784)
     at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
     at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
     at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
     at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
     at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
     at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
     at org.eclipse.jface.window.Window.open(Window.java:801)
     at com.impact.qtl12.imports.UI.CSVFile.QTL$4.widgetSelected(QTL.java:427)
     at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
     at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
     at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
     at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
     at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
     at com.impact.qtl12.imports.UI.CSVFile.QTL.createShell(QTL.java:767)
     at com.impact.qtl12.imports.UI.CSVFile.QTL.launch(QTL.java:826)
     at com.impact.qtl12.imports.UI.CSVFile.QTL.main(QTL.java:847)


whats solution for this ?

Regards

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points