0

I am populating each cell of a table with drop down lists, I have 2961 rows in my table, here is the code:

    TableItem[] items = table.getItems();
    for (int i = 0; i < 1000; i++) {
      TableEditor tableEditor = new TableEditor(table);
      CCombo combo = null; 

           combo = new CCombo(table, SWT.NONE);
          combo.setText("CalleesExecuted");
          for(Method2Representation caller:methodtraces2.get(i).getCalleesListExecuted()) {
              combo.add(caller.toString());

          }
          tableEditor.grabHorizontal = true;
          tableEditor.setEditor(combo, items[i], 13);




    }

the code works fine for i<1000. However, when I use i<2961, which corresponds to the number of rows that needs to be input within my table, I get the error:

Exception in thread "main" org.eclipse.swt.SWTError: No more handles
at org.eclipse.swt.SWT.error(SWT.java:4559)
at org.eclipse.swt.SWT.error(SWT.java:4448)
at org.eclipse.swt.SWT.error(SWT.java:4419)
at org.eclipse.swt.widgets.Widget.error(Widget.java:482)
at org.eclipse.swt.widgets.Control.createHandle(Control.java:718)
at org.eclipse.swt.widgets.Composite.createHandle(Composite.java:292)
at org.eclipse.swt.widgets.Decorations.createHandle(Decorations.java:430)
at org.eclipse.swt.widgets.Shell.createHandle(Shell.java:593)
at org.eclipse.swt.widgets.Control.createWidget(Control.java:758)
at org.eclipse.swt.widgets.Scrollable.createWidget(Scrollable.java:151)
at org.eclipse.swt.widgets.Decorations.createWidget(Decorations.java:439)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:300)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:379)
at org.eclipse.swt.custom.CCombo.createPopup(CCombo.java:472)
at org.eclipse.swt.custom.CCombo.(CCombo.java:158)
at mygui.createContents(mygui.java:184)
at mygui.open(mygui.java:60)
at mygui.main(mygui.java:49)

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • 3
    You have probably hit a limit in the operating system - there are just too many conrols. – greg-449 Jun 10 '18 at 07:21
  • 2
    Possible duplicate of [SWT No More Handles](https://stackoverflow.com/questions/2018553/swt-no-more-handles) – Shashwat Jun 11 '18 at 04:03

0 Answers0