Eclipse RCP项目获取异常“org.eclipse.e4.core.di.InjectionException:org.eclipse.swt.SWTError:不再处理”

时间:2017-05-09 16:27:07

标签: windows eclipse eclipse-plugin swt eclipse-rcp

我在eclipse RCP项目中创建了一个应用程序Runner。在我的Runner应用程序中 我正在使用树,在这棵树上我有一个五个树柱。另外创建两个treeItem,一个是父项和另一个子项,通过编程从数据库中将它们的值放在treecolumn中。在此表中,我已实现多选组合和CCombo以获取多个值。如果我在这个表中传递了近1000个数据,那么我就得到了这个 例外:

org.eclipse.e4.core.di.InjectionException:org.eclipse.swt.SWTError:不再处理

如果我调试此代码,我将在CCombo或multicombo实现中获得此异常。

我有两个表Remote和Localhost两个表在执行时获取数据。请查找下面的表格实现代码。帮助我如何处理这个异常。

private void createTestSuiteTable( final Tree table) 
    {      

    /*Dispose all elements*/
      int[] selection = new int[] { 0 };
    TreeItem items[] = table.getItems();
    for(int i=0;i<items.length;i++)
    {
        items[i].dispose();
    }
//       remoteTable.removeAll();
    /*Get all remote computer IPs*/
    UserConfigurationGSON userGson = ConfigurationAPIHandler.getInstance().getSpecificConfiguration(Utilities.AUTOMATICS_USERNAME);
    String remoteComputerIPs[] =null;
    if(userGson.remoteMachines.size()>0)
    {
        remoteComputerIPs = new String[userGson.remoteMachines.size()];
        for(int i=0;i<userGson.remoteMachines.size();i++)
        {
            remoteComputerIPs[i] = userGson.remoteMachines.get(i).ip;
        }
    }
    else
    {
        remoteComputerIPs = new String[1];
        remoteComputerIPs[0] = "NONE";
    }
    /*Arraylist for Execution Type*/
    ArrayList<String> exeTypes = new ArrayList<String>(){{
                                        add("ANDROID_NATIVE");add("ANDROID_WEB");
                                        add("WINDOWS_WEB");add("WINDOWS_NONWEB");

                                    }};
    /*Arraylist for Execution Platform*/
    ArrayList<String> exePlatform = new ArrayList<String>(){{
                                        add("FireFox");add("IE");
                                        add("Chrome");add("Safari");
                                        }};

    TSGson tsGsons[] = TestSuiteAPIHandler.getInstance().getAllTestSuites();
    boolean checked=false;
    for (TSGson tsGson : tsGsons) 
    {
        parentTestSuite = new TreeItem(table, SWT.NONE|SWT.MULTI);
        parentTestSuite.setText(new String[] { "" +tsGson.tsName, "", "","","","" });
        parentTestSuite.setData("EltType","TESTSUITE");

        if(tsGson.tsTCLink==null)
                continue;

        if(table.equals(remoteTable))
        {
            long startTime = System.currentTimeMillis();
//              System.err.println("createTestSuiteTableRemote Strat Time"+startTime);
            for(TSTCGson tsTCGson : tsGson.tsTCLink) 
            {
                final TreeItem trtmTestcases = new TreeItem(parentTestSuite, SWT.NONE|SWT.MULTI);
                trtmTestcases.setText(new String[] {
                        tsTCGson.tcName, 
                        tsTCGson.tcParams.get(0)!=null ? tsTCGson.tcParams.get(0).tcparamValue:"",
                        tsTCGson.tcParams.get(1)!=null ? tsTCGson.tcParams.get(1).tcparamValue:"",
                        tsTCGson.tcParams.get(2)!=null ? tsTCGson.tcParams.get(2).tcparamValue:"",
                        tsTCGson.tcParams.get(3)!=null ? tsTCGson.tcParams.get(3).tcparamValue:"", 
                        tsTCGson.tcParams.get(4)!=null ? tsTCGson.tcParams.get(4).tcparamValue:"" });
                trtmTestcases.setData("EltType","TESTCASE");

                table.setSelection(parentTestSuite);
                if(checked)
                {
                      trtmTestcases.setChecked(checked);
                }

                final CCombo comboForRunOn = new CCombo(remoteTable, SWT.READ_ONLY| SWT.CHECK);
                comboForRunOn.setItems(remoteComputerIPs);

                /*Exe Type - WINDOWS, ANDROID*/

                final CCombo comboForExeType = new CCombo(remoteTable, SWT.READ_ONLY);
                comboForExeType.setItems(exeTypes.toArray(new String[exeTypes.size()]));
                comboForExeType.select(exeTypes.indexOf(tsTCGson.tcParams.get(1).tcparamValue));
                /*Exe Type - Firefox, IE, Chrome*/
                exePlatform.indexOf(tsTCGson.tcParams.get(1).tcparamValue);
                final MultiSelectionCombo comboForExePlatform = new MultiSelectionCombo(remoteTable,trtmTestcases,exePlatform.toArray(new String[exePlatform.size()]),selection, SWT.READ_ONLY| SWT.CHECK);

                TreeEditor editorForRunOn = new TreeEditor(remoteTable);
                TreeEditor editorForExeType = new TreeEditor(remoteTable);
                TreeEditor editorForExePlatform = new TreeEditor(remoteTable);
                editorForRunOn.setEditor(comboForRunOn, trtmTestcases, 3);
                editorForExeType.setEditor(comboForExeType, trtmTestcases, 2);
                comboForExeType.setText(tsTCGson.tcParams.get(1).tcparamValue);
                editorForExePlatform.setEditor(comboForExePlatform, trtmTestcases, 1);
                comboForExePlatform.setValueofDisplay(tsTCGson.tcParams.get(0).tcparamValue);

                editorForRunOn.horizontalAlignment = SWT.LEFT;
                editorForRunOn.grabHorizontal = true;
                editorForExeType.horizontalAlignment = SWT.LEFT; 
                editorForExeType.grabHorizontal = true;
                editorForExePlatform.horizontalAlignment = SWT.LEFT; 
                editorForExePlatform.grabHorizontal = true;

                // Optional, but allows you to get the current value by calling
                // item.getText() instead of going through the TreeEditor and
                // calling ((CCombo) editor.getEditor()).getText()

                comboForRunOn.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) 
                    {
                      trtmTestcases.setText(3, comboForRunOn.getText()); 
                    }
                });
                comboForExeType.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) 
                    {
                      trtmTestcases.setText(2, comboForExeType.getText());
                    }
                });

                long estimatedTime = System.currentTimeMillis() - startTime;

//                  System.err.println("Estimated time for reomte table"+estimatedTime);

            }
        }

0 个答案:

没有答案