Example #1
0
  private void addSearchButton(ToolBar toolBar) {
    final Text search = new Text(toolBar, SWT.SEARCH | SWT.ICON_CANCEL);
    search.setSize(100, SWT.DEFAULT);
    search.setMessage(Messages.LabelSearch);

    ToolItem toolItem = new ToolItem(toolBar, SWT.SEPARATOR);
    toolItem.setWidth(search.getSize().x);
    toolItem.setControl(search);

    search.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            String filter = search.getText().trim();
            if (filter.length() == 0) {
              filterPattern = null;
              securities.refresh();
            } else {
              filterPattern =
                  Pattern.compile(
                      ".*" + filter + ".*", Pattern.CASE_INSENSITIVE); // $NON-NLS-1$ //$NON-NLS-2$
              securities.refresh();
            }
          }
        });
  }
  protected Control createDialogArea(Composite parent) {
    parent.setBackground(EccTreeControl.color);
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_FOREGROUND));
    composite.setLayout(new FillLayout(SWT.HORIZONTAL));
    TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    tabFolder.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_FOREGROUND));

    TabItem basicItem = new TabItem(tabFolder, SWT.NONE);
    basicItem.setText("基本");

    Composite composite1 = new Composite(tabFolder, SWT.NONE);
    composite1.setBackground(EccTreeControl.color);
    basicItem.setControl(composite1);

    SashForm sashForm = new SashForm(composite1, SWT.VERTICAL);
    sashForm.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    sashForm.setSize(445, 211);
    sashForm.setLocation(0, 0);

    Composite composite_1 = new Composite(sashForm, SWT.NONE);
    composite_1.setBackground(EccTreeControl.color);

    ICollection ico = FileTools.getBussCollection("TaskName", name, "EccTaskPlan");
    IEnumerator ien = ico.GetEnumerator();
    while (ien.MoveNext()) {
      bo = (BusinessObject) ien.get_Current();
      if (bo != null && bo.GetField("Model").get_NativeValue().toString().equals("绝对时间任务计划")) {
        TaskName = bo.GetField("TaskName").get_NativeValue().toString();
        Instruction = bo.GetField("Instruction").get_NativeValue().toString();
        StatrtTime = bo.GetField("StatrtTime").get_NativeValue().toString();
        String[] s2 = StatrtTime.split(";");
        String[] b1 = s2[0].split(",");
        time = b1[1];
        String[] b2 = s2[1].split(",");
        time_1 = b2[1];
        String[] b3 = s2[2].split(",");
        time_2 = b3[1];
        String[] b4 = s2[3].split(",");
        time_3 = b4[1];
        String[] b5 = s2[4].split(",");
        time_4 = b5[1];
        String[] b6 = s2[5].split(",");
        time_5 = b6[1];
        String[] b7 = s2[6].split(",");
        time_6 = b7[1];

        Status = bo.GetField("Status").get_NativeValue().toString();
        String[] s1 = Status.split(";");
        String[] a1 = s1[0].split(":");
        date = a1[0]; // 星期日
        permission = a1[1];
        String[] a2 = s1[1].split(":");
        date_1 = a2[0]; // 星期一
        permission_1 = a2[1];
        String[] a3 = s1[2].split(":");
        date_2 = a3[0]; // 星期二
        permission_2 = a3[1];
        String[] a4 = s1[3].split(":");
        date_3 = a4[0]; // 星期三
        permission_3 = a4[1];
        String[] a5 = s1[4].split(":");
        date_4 = a5[0]; // 星期四
        permission_4 = a5[1];
        String[] a6 = s1[5].split(":");
        date_5 = a6[0]; // 星期五
        permission_5 = a6[1];
        String[] a7 = s1[6].split(":");
        date_6 = a7[0]; // 星期六
        permission_6 = a7[1];
      }
    }

    text = new Text(composite_1, SWT.BORDER); // 任务计划名称
    text.setLocation(137, 0);
    text.setSize(177, 18);
    text.setText(TaskName);
    text.setEnabled(false);

    Label lblNewLabel = new Label(composite_1, SWT.NONE);
    lblNewLabel.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_FOREGROUND));
    lblNewLabel.setFont(SWTResourceManager.getFont("宋体", 10, SWT.NORMAL));
    lblNewLabel.setBounds(10, 2, 102, 18);
    lblNewLabel.setText("\u4EFB\u52A1\u8BA1\u5212\u540D\u79F0*:");

    Composite composite_2 = new Composite(sashForm, SWT.NONE);
    composite_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));

    lblNewLabel_1 = new Label(composite_2, SWT.NONE);
    lblNewLabel_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_1.setBounds(20, 10, 54, 16);
    lblNewLabel_1.setText("星期日");

    btnCheckButton = new Button(composite_2, SWT.CHECK);
    btnCheckButton.setBounds(102, 8, 45, 16);
    btnCheckButton.setBackground(EccTreeControl.color);
    btnCheckButton.setText("\u5141\u8BB8");
    if (lblNewLabel_1.getText().equals(date) && permission.equals("允许")) {
      btnCheckButton.setSelection(true);
    } else if (lblNewLabel_1.getText().equals(date) && permission.equals("禁止")) {
      btnCheckButton.setSelection(false);
    }

    final DateTime startTime = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime.setLocation(164, 10);
    startTime.setSize(79, 15);
    int h = Integer.parseInt(time.substring(0, time.indexOf(":")));
    int m = Integer.parseInt(time.substring(time.indexOf(":") + 1, time.lastIndexOf(":")));
    int mm = Integer.parseInt(time.substring(time.lastIndexOf(":") + 1));
    startTime.setTime(h, m, mm);
    startTimeStr =
        startTime.getHours() + ":" + startTime.getMinutes() + ":" + startTime.getSeconds();
    startTime.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr =
                startTime.getHours() + ":" + startTime.getMinutes() + ":" + startTime.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_2 = new Label(composite_2, SWT.NONE);
    lblNewLabel_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_2.setBounds(20, 32, 54, 16);
    lblNewLabel_2.setText("星期一");

    btnCheckButton_1 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_1.setBounds(102, 30, 45, 16);
    btnCheckButton_1.setBackground(EccTreeControl.color);
    btnCheckButton_1.setText("\u5141\u8BB8");
    if (lblNewLabel_2.getText().equals(date_1) && permission_1.equals("允许")) {
      btnCheckButton_1.setSelection(true);
    } else if (lblNewLabel_2.getText().equals(date_1) && permission_1.equals("禁止")) {
      btnCheckButton_1.setSelection(false);
    }

    final DateTime startTime_1 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_1.setLocation(164, 31);
    startTime_1.setSize(79, 15);
    int h1 = Integer.parseInt(time_1.substring(0, time_1.indexOf(":")));
    int m1 = Integer.parseInt(time_1.substring(time_1.indexOf(":") + 1, time_1.lastIndexOf(":")));
    int mm1 = Integer.parseInt(time_1.substring(time_1.lastIndexOf(":") + 1));
    startTime_1.setTime(h1, m1, mm1);
    startTimeStr_1 =
        startTime_1.getHours() + ":" + startTime_1.getMinutes() + ":" + startTime_1.getSeconds();
    startTime_1.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_1 =
                startTime_1.getHours()
                    + ":"
                    + startTime_1.getMinutes()
                    + ":"
                    + startTime_1.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_3 = new Label(composite_2, SWT.NONE);
    lblNewLabel_3.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_3.setBounds(20, 54, 54, 16);
    lblNewLabel_3.setText("星期二");

    btnCheckButton_2 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_2.setBackground(EccTreeControl.color);
    btnCheckButton_2.setBounds(102, 51, 45, 16);
    btnCheckButton_2.setText("\u5141\u8BB8");
    if (lblNewLabel_3.getText().equals(date_2) && permission_2.equals("允许")) {
      btnCheckButton_2.setSelection(true);
    } else if (lblNewLabel_3.getText().equals(date_2) && permission_2.equals("禁止")) {
      btnCheckButton_2.setSelection(false);
    }

    final DateTime startTime_2 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_2.setLocation(164, 52);
    startTime_2.setSize(79, 15);
    int h2 = Integer.parseInt(time_2.substring(0, time_2.indexOf(":")));
    int m2 = Integer.parseInt(time_2.substring(time_2.indexOf(":") + 1, time_2.lastIndexOf(":")));
    int mm2 = Integer.parseInt(time_2.substring(time_2.lastIndexOf(":") + 1));
    startTime_2.setTime(h2, m2, mm2);
    startTimeStr_2 =
        startTime_2.getHours() + ":" + startTime_2.getMinutes() + ":" + startTime_2.getSeconds();
    startTime_2.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_2 =
                startTime_2.getHours()
                    + ":"
                    + startTime_2.getMinutes()
                    + ":"
                    + startTime_2.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_4 = new Label(composite_2, SWT.NONE);
    lblNewLabel_4.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_4.setBounds(20, 76, 54, 16);
    lblNewLabel_4.setText("星期三");

    btnCheckButton_3 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_3.setBackground(EccTreeControl.color);
    btnCheckButton_3.setBounds(102, 71, 45, 16);
    btnCheckButton_3.setText("\u5141\u8BB8");
    if (lblNewLabel_4.getText().equals(date_3) && permission_3.equals("允许")) {
      btnCheckButton_3.setSelection(true);
    } else if (lblNewLabel_4.getText().equals(date_3) && permission_3.equals("禁止")) {
      btnCheckButton_3.setSelection(false);
    }

    final DateTime startTime_3 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_3.setLocation(164, 73);
    startTime_3.setSize(79, 15);
    int h3 = Integer.parseInt(time_3.substring(0, time_3.indexOf(":")));
    int m3 = Integer.parseInt(time_3.substring(time_3.indexOf(":") + 1, time_3.lastIndexOf(":")));
    int mm3 = Integer.parseInt(time_3.substring(time_3.lastIndexOf(":") + 1));
    startTime_3.setTime(h3, m3, mm3);
    startTimeStr_3 =
        startTime_3.getHours() + ":" + startTime_3.getMinutes() + ":" + startTime_3.getSeconds();
    startTimeStr_3 =
        startTime_3.getHours() + ":" + startTime_3.getMinutes() + ":" + startTime_3.getSeconds();
    startTime_3.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_3 =
                startTime_3.getHours()
                    + ":"
                    + startTime_3.getMinutes()
                    + ":"
                    + startTime_3.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_5 = new Label(composite_2, SWT.NONE);
    lblNewLabel_5.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_5.setBounds(20, 98, 54, 16);
    lblNewLabel_5.setText("星期四");

    button = new Button(composite_2, SWT.CHECK);
    button.setBackground(EccTreeControl.color);
    button.setText("\u5141\u8BB8");
    button.setBounds(102, 93, 45, 16);
    if (lblNewLabel_5.getText().equals(date_4) && permission_4.equals("允许")) {
      button.setSelection(true);
    } else if (lblNewLabel_5.getText().equals(date_4) && permission_4.equals("禁止")) {
      button.setSelection(false);
    }

    final DateTime startTime_4 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_4.setLocation(164, 94);
    startTime_4.setSize(79, 15);
    int h4 = Integer.parseInt(time_4.substring(0, time_4.indexOf(":")));
    int m4 = Integer.parseInt(time_4.substring(time_4.indexOf(":") + 1, time_4.lastIndexOf(":")));
    int mm4 = Integer.parseInt(time_4.substring(time_4.lastIndexOf(":") + 1));
    startTime_4.setTime(h4, m4, mm4);
    startTimeStr_4 =
        startTime_4.getHours() + ":" + startTime_4.getMinutes() + ":" + startTime_4.getSeconds();
    startTime_4.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_4 =
                startTime_4.getHours()
                    + ":"
                    + startTime_4.getMinutes()
                    + ":"
                    + startTime_4.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_6 = new Label(composite_2, SWT.NONE);
    lblNewLabel_6.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_6.setBounds(20, 120, 54, 12);
    lblNewLabel_6.setText("星期五");
    btnCheckButton_4 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_4.setBackground(EccTreeControl.color);
    btnCheckButton_4.setBounds(102, 115, 45, 16);
    btnCheckButton_4.setText("\u5141\u8BB8");
    if (lblNewLabel_6.getText().equals(date_5) && permission_5.equals("允许")) {
      btnCheckButton_4.setSelection(true);
    } else if (lblNewLabel_6.getText().equals(date_5) && permission_5.equals("禁止")) {
      btnCheckButton_4.setSelection(false);
    }

    final DateTime startTime_5 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_5.setLocation(164, 115);
    startTime_5.setSize(79, 15);
    int h5 = Integer.parseInt(time_5.substring(0, time_5.indexOf(":")));
    int m5 = Integer.parseInt(time_5.substring(time_5.indexOf(":") + 1, time_5.lastIndexOf(":")));
    int mm5 = Integer.parseInt(time_5.substring(time_5.lastIndexOf(":") + 1));
    startTime_5.setTime(h5, m5, mm5);
    startTimeStr_5 =
        startTime_5.getHours() + ":" + startTime_5.getMinutes() + ":" + startTime_5.getSeconds();
    startTime_5.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_5 =
                startTime_5.getHours()
                    + ":"
                    + startTime_5.getMinutes()
                    + ":"
                    + startTime_5.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_7 = new Label(composite_2, SWT.NONE);
    lblNewLabel_7.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_7.setBounds(20, 142, 54, 16);
    lblNewLabel_7.setText("星期六");

    btnCheckButton_5 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_5.setBackground(EccTreeControl.color);
    btnCheckButton_5.setBounds(102, 137, 45, 16);
    btnCheckButton_5.setText("\u5141\u8BB8");
    if (lblNewLabel_7.getText().equals(date_6) && permission_6.equals("允许")) {
      btnCheckButton_5.setSelection(true);
    } else if (lblNewLabel_7.getText().equals(date_6) && permission_6.equals("禁止")) {
      btnCheckButton_5.setSelection(false);
    }

    final DateTime startTime_6 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_6.setLocation(164, 136);
    startTime_6.setSize(79, 15);
    int h6 = Integer.parseInt(time_6.substring(0, time_6.indexOf(":")));
    int m6 = Integer.parseInt(time_6.substring(time_6.indexOf(":") + 1, time_6.lastIndexOf(":")));
    int mm6 = Integer.parseInt(time_6.substring(time_6.lastIndexOf(":") + 1));
    startTime_6.setTime(h6, m6, mm6);
    startTimeStr_6 =
        startTime_6.getHours() + ":" + startTime_6.getMinutes() + ":" + startTime_6.getSeconds();
    startTime_6.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_6 =
                startTime_6.getHours()
                    + ":"
                    + startTime_6.getMinutes()
                    + ":"
                    + startTime_6.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    sashForm.setWeights(new int[] {1, 8});

    TabItem describeItem = new TabItem(tabFolder, SWT.NONE);
    describeItem.setText("描述");

    Composite composite2 = new Composite(tabFolder, SWT.NONE);
    composite2.setBackground(EccTreeControl.color);
    describeItem.setControl(composite2);
    composite2.setLayout(new BorderLayout(0, 0));

    Label label = new Label(composite2, SWT.HORIZONTAL);
    label.setAlignment(SWT.CENTER);
    label.setBackground(EccTreeControl.color);
    label.setBounds(0, 0, 54, 199);
    label.setLayoutData(BorderLayout.WEST);
    label.setText("\u63CF\u8FF0\uFF1A");

    text1 = new Text(composite2, SWT.WRAP | SWT.BORDER); // 描述
    text1.setLayoutData(BorderLayout.CENTER);
    text1.setText(Instruction);

    return composite;
  }
  private void createFormBasicSection(final ScrolledForm form, FormToolkit toolkit) {
    /* Basic Section */
    Section basicSection =
        toolkit.createSection(form.getBody(), Section.TWISTIE | Section.EXPANDED);
    basicSection.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground());
    basicSection.setToggleColor(toolkit.getColors().getColor(FormColors.SEPARATOR));
    toolkit.createCompositeSeparator(basicSection);
    GridData samplegridData = new GridData();
    samplegridData.horizontalSpan = 3;
    samplegridData.horizontalAlignment = SWT.FILL;
    samplegridData.grabExcessHorizontalSpace = true;
    basicSection.addExpansionListener(
        new ExpansionAdapter() {
          public void expansionStateChanged(ExpansionEvent e) {
            form.reflow(false);
          }
        });
    basicSection.setLayoutData(samplegridData);
    basicSection.setText(Messages.getString("ScheduledTaskPage.section.basic"));
    // section.setLayoutData(new TableWrapData(TableWrapData.FILL));

    Composite basicSectionClient = toolkit.createComposite(basicSection);
    basicSectionClient.setLayout(new GridLayout());

    toolkit.createLabel(basicSectionClient, "Task Name");
    taskName = toolkit.createText(basicSectionClient, "");
    taskName.setBackground(new Color(null, 229, 236, 253));
    taskName.setSize(8000, 10);
    GridData taskNameGridData = new GridData();
    taskNameGridData.horizontalSpan = 3;
    taskNameGridData.horizontalAlignment = GridData.FILL;
    taskNameGridData.grabExcessHorizontalSpace = true;
    taskName.setLayoutData(taskNameGridData);
    taskName.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            setSave(true);
            updateDirtyState();
          }
        });

    toolkit.createLabel(basicSectionClient, "Task Group");
    taskGroup = toolkit.createText(basicSectionClient, "synapse.simple.quartz");
    taskGroup.setBackground(new Color(null, 229, 236, 253));
    GridData taskGroupGridData = new GridData();
    taskGroupGridData.horizontalSpan = 3;
    taskGroupGridData.horizontalAlignment = GridData.FILL;
    taskGroupGridData.grabExcessHorizontalSpace = true;
    taskGroup.setLayoutData(taskGroupGridData);
    taskGroup.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            setSave(true);
            updateDirtyState();
          }
        });

    basicSection.setClient(basicSectionClient);
  }
  /** Adds the 'clear' button at the bottom */
  private void setupButtons(Composite parent) {
    Composite buttonComposite = new Composite(parent, SWT.NONE);
    buttonComposite.setLayout(new GridLayout(3, false));
    buttonComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));

    new Label(buttonComposite, SWT.NONE).setText("Clear and add records");

    final Text clearText = new Text(buttonComposite, SWT.BORDER);
    clearText.setText(Integer.toString(defaultDatasetSize));
    clearText.setLayoutData(new GridData(100, 14));
    clearText.setSize(100, 20);

    Button clearButton = new Button(buttonComposite, SWT.PUSH);
    clearButton.setText("Apply");
    clearButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            final Integer newRecordCount = Integer.valueOf(clearText.getText());
            try {
              //					eventList.getReadWriteLock().writeLock().lock();
              //					eventList.clear();
              // eventList.addAll(dataList.getList(newRecordCount));
            } finally {
              //					eventList.getReadWriteLock().writeLock().unlock();
              log(">> List cleared. Added " + newRecordCount + " new records.");
            }
          }
        });

    new Label(buttonComposite, SWT.PUSH).setText("Updates/sec");

    final Text updateSpeedText = new Text(buttonComposite, SWT.BORDER);
    updateSpeedText.setLayoutData(new GridData(100, 14));
    updateSpeedText.setText(Integer.toString(updatesPerSecond));

    Button updateSpeedButton = new Button(buttonComposite, SWT.PUSH);
    updateSpeedButton.setText("Apply");
    updateSpeedButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            System.out.println(total / 10000);
            ProgressMonitorDialog dialog =
                new ProgressMonitorDialog(Display.getDefault().getActiveShell());
            try {
              dialog.run(
                  true,
                  true,
                  new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor) {
                      monitor.beginTask("Some nice progress message here ...", total / 10000);
                      // execute the task ...
                      String query =
                          "selectattr /belle2/MC/generic/E07/FC:FILE /belle2/MC/generic/E07/FC:id /belle2/MC/generic/E07/FC:guid "
                              + "/belle2/MC/generic/E07/FC:lfn /belle2/MC/generic/E07/FC:status /belle2/MC/generic/E07/FC:events "
                              + "/belle2/MC/generic/E07/FC:datasetid /belle2/MC/generic/E07/FC:stream /belle2/MC/generic/E07/FC:runL "
                              + "/belle2/MC/generic/E07/FC:runH '/belle2/MC/generic/E07/FC:runL>=1 and /belle2/MC/generic/E07/FC:runH<=9999'";
                      try {
                        conn.execute(query);
                        long start = System.currentTimeMillis();
                        int c = 0;
                        int cnt = 0;
                        List<IRecord> recs = new ArrayList<IRecord>();
                        while (!conn.eot()) {
                          final IRecord added = Record.newRecord();
                          for (int i = 0; i < map.keySet().size(); i++) {
                            String row = conn.fetchRow();
                            added.set(keys[i], row);
                          }
                          recs.add(added);
                          if (c > 10000) {
                            System.out.println("add start " + c);
                            addEventList(recs, cnt);
                            recs = new ArrayList<IRecord>();
                            c = 0;
                            //
                            monitor.worked(1);
                            monitor.subTask("add record " + cnt);
                          } else c++;
                          // results.add(row);
                          cnt++;

                          if (monitor.isCanceled()) {
                            // conn.skipToEOT();
                            break;
                          }
                        }
                        System.out.println(System.currentTimeMillis() - start);
                      } catch (Exception ex) {

                      }
                      monitor.done();
                    }
                  });
            } catch (InvocationTargetException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            } catch (InterruptedException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }

            // conn.disconnect();
            //

            // scheduledThreadPool.shutdownNow();
            // onStart();
          }
        });
  }
  /** Opens the Dialog Shell. Auto-generated code - any changes you make will disappear. */
  public void open() {
    try {
      preInitGUI();

      Shell parent = getParent();
      dialogShell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
      dialogShell.setText(getText());

      composite2 = new Composite(dialogShell, SWT.NULL);
      isLocalBtn = new Button(composite2, SWT.CHECK | SWT.LEFT);
      isAbstractBtn = new Button(composite2, SWT.CHECK | SWT.LEFT);
      repositoryIdTxt = new Text(composite2, SWT.BORDER);
      versionTxt = new Text(composite2, SWT.BORDER);
      identifierTxt = new Text(composite2, SWT.BORDER);
      versionLb = new Label(composite2, SWT.NULL);
      repositoryIdLb = new Label(composite2, SWT.NULL);
      idLb = new Label(composite2, SWT.NULL);
      composite3 = new Composite(dialogShell, SWT.NULL);
      cancel = new Button(composite3, SWT.PUSH | SWT.CENTER);
      enter = new Button(composite3, SWT.PUSH | SWT.CENTER);

      dialogShell.setText("Add Module");
      dialogShell.setSize(new org.eclipse.swt.graphics.Point(476, 145));

      GridData composite2LData = new GridData();
      composite2LData.verticalAlignment = GridData.CENTER;
      composite2LData.horizontalAlignment = GridData.BEGINNING;
      composite2LData.widthHint = 464;
      composite2LData.heightHint = 102;
      composite2LData.horizontalIndent = 0;
      composite2LData.horizontalSpan = 1;
      composite2LData.verticalSpan = 1;
      composite2LData.grabExcessHorizontalSpace = false;
      composite2LData.grabExcessVerticalSpace = false;
      composite2.setLayoutData(composite2LData);
      composite2.setSize(new org.eclipse.swt.graphics.Point(464, 102));

      FormData isLocalBtnLData = new FormData();
      isLocalBtnLData.height = 20;
      isLocalBtnLData.width = 70;
      isLocalBtnLData.left = new FormAttachment(519, 1000, 0);
      isLocalBtnLData.right = new FormAttachment(750, 1000, 0);
      isLocalBtnLData.top = new FormAttachment(700, 1000, 0);
      isLocalBtnLData.bottom = new FormAttachment(897, 1000, 0);
      isLocalBtn.setLayoutData(isLocalBtnLData);
      isLocalBtn.setText("is local");
      isLocalBtn.setSize(new org.eclipse.swt.graphics.Point(70, 20));
      final Font isLocalBtnfont = new Font(Display.getDefault(), "Tahoma", 8, 1);
      isLocalBtn.setFont(isLocalBtnfont);

      FormData isAbstractBtnLData = new FormData();
      isAbstractBtnLData.height = 20;
      isAbstractBtnLData.width = 100;
      isAbstractBtnLData.left = new FormAttachment(239, 1000, 0);
      isAbstractBtnLData.right = new FormAttachment(475, 1000, 0);
      isAbstractBtnLData.top = new FormAttachment(700, 1000, 0);
      isAbstractBtnLData.bottom = new FormAttachment(897, 1000, 0);
      isAbstractBtn.setLayoutData(isAbstractBtnLData);
      isAbstractBtn.setText("is abstract");
      isAbstractBtn.setSize(new org.eclipse.swt.graphics.Point(100, 20));
      isAbstractBtn.setFont(isLocalBtnfont);

      FormData repositoryIdTxtLData = new FormData();
      repositoryIdTxtLData.height = 13;
      repositoryIdTxtLData.width = 352;
      repositoryIdTxtLData.left = new FormAttachment(239, 1000, 0);
      repositoryIdTxtLData.right = new FormAttachment(996, 1000, 0);
      repositoryIdTxtLData.top = new FormAttachment(269, 1000, 0);
      repositoryIdTxtLData.bottom = new FormAttachment(465, 1000, 0);
      repositoryIdTxt.setLayoutData(repositoryIdTxtLData);
      repositoryIdTxt.setDoubleClickEnabled(false);
      final Font repositoryIdTxtfont = new Font(Display.getDefault(), "Tahoma", 7, 0);
      repositoryIdTxt.setFont(repositoryIdTxtfont);
      repositoryIdTxt.setEditable(false);
      repositoryIdTxt.setSize(new org.eclipse.swt.graphics.Point(352, 13));
      repositoryIdTxt.setEnabled(false);

      FormData versionTxtLData = new FormData();
      versionTxtLData.height = 13;
      versionTxtLData.width = 352;
      versionTxtLData.left = new FormAttachment(239, 1000, 0);
      versionTxtLData.right = new FormAttachment(996, 1000, 0);
      versionTxtLData.top = new FormAttachment(485, 1000, 0);
      versionTxtLData.bottom = new FormAttachment(691, 1000, 0);
      versionTxt.setLayoutData(versionTxtLData);
      versionTxt.setFont(repositoryIdTxtfont);
      versionTxt.setSize(new org.eclipse.swt.graphics.Point(352, 13));
      versionTxt.addKeyListener(
          new KeyAdapter() {
            public void keyReleased(KeyEvent evt) {
              versionTxtKeyReleased(evt);
            }
          });

      FormData identifierTxtLData = new FormData();
      identifierTxtLData.height = 13;
      identifierTxtLData.width = 352;
      identifierTxtLData.left = new FormAttachment(239, 1000, 0);
      identifierTxtLData.right = new FormAttachment(996, 1000, 0);
      identifierTxtLData.top = new FormAttachment(48, 1000, 0);
      identifierTxtLData.bottom = new FormAttachment(250, 1000, 0);
      identifierTxt.setLayoutData(identifierTxtLData);
      identifierTxt.setFont(repositoryIdTxtfont);
      identifierTxt.setSize(new org.eclipse.swt.graphics.Point(352, 13));
      identifierTxt.setFocus();
      identifierTxt.addKeyListener(
          new KeyAdapter() {
            public void keyReleased(KeyEvent evt) {
              identifierTxtKeyReleased(evt);
            }
          });

      FormData versionLbLData = new FormData();
      versionLbLData.height = 20;
      versionLbLData.width = 90;
      versionLbLData.left = new FormAttachment(11, 1000, 0);
      versionLbLData.right = new FormAttachment(245, 1000, 0);
      versionLbLData.top = new FormAttachment(485, 1000, 0);
      versionLbLData.bottom = new FormAttachment(681, 1000, 0);
      versionLb.setLayoutData(versionLbLData);
      versionLb.setText("Version:");
      versionLb.setSize(new org.eclipse.swt.graphics.Point(90, 20));
      versionLb.setFont(isLocalBtnfont);

      FormData repositoryIdLbLData = new FormData();
      repositoryIdLbLData.height = 20;
      repositoryIdLbLData.width = 90;
      repositoryIdLbLData.left = new FormAttachment(11, 1000, 0);
      repositoryIdLbLData.right = new FormAttachment(245, 1000, 0);
      repositoryIdLbLData.top = new FormAttachment(269, 1000, 0);
      repositoryIdLbLData.bottom = new FormAttachment(465, 1000, 0);
      repositoryIdLb.setLayoutData(repositoryIdLbLData);
      repositoryIdLb.setText("Repository ID:");
      repositoryIdLb.setSize(new org.eclipse.swt.graphics.Point(90, 20));
      repositoryIdLb.setFont(isLocalBtnfont);

      FormData idLbLData = new FormData();
      idLbLData.height = 20;
      idLbLData.width = 90;
      idLbLData.left = new FormAttachment(11, 1000, 0);
      idLbLData.right = new FormAttachment(245, 1000, 0);
      idLbLData.top = new FormAttachment(53, 1000, 0);
      idLbLData.bottom = new FormAttachment(250, 1000, 0);
      idLb.setLayoutData(idLbLData);
      idLb.setText("Identifier:");
      idLb.setSize(new org.eclipse.swt.graphics.Point(90, 20));
      idLb.setFont(isLocalBtnfont);
      FormLayout composite2Layout = new FormLayout();
      composite2.setLayout(composite2Layout);
      composite2Layout.marginWidth = 0;
      composite2Layout.marginHeight = 0;
      composite2Layout.spacing = 0;
      composite2.layout();

      GridData composite3LData = new GridData();
      composite3LData.verticalAlignment = GridData.CENTER;
      composite3LData.horizontalAlignment = GridData.BEGINNING;
      composite3LData.widthHint = 466;
      composite3LData.heightHint = 46;
      composite3LData.horizontalIndent = 0;
      composite3LData.horizontalSpan = 1;
      composite3LData.verticalSpan = 1;
      composite3LData.grabExcessHorizontalSpace = false;
      composite3LData.grabExcessVerticalSpace = false;
      composite3.setLayoutData(composite3LData);
      composite3.setSize(new org.eclipse.swt.graphics.Point(466, 46));

      FormData cancelLData = new FormData();
      cancelLData.height = 21;
      cancelLData.width = 80;
      cancelLData.left = new FormAttachment(816, 1000, 0);
      cancelLData.right = new FormAttachment(988, 1000, 0);
      cancelLData.top = new FormAttachment(6, 1000, 0);
      cancelLData.bottom = new FormAttachment(580, 1000, 0);
      cancel.setLayoutData(cancelLData);
      cancel.setText("CANCEL");
      cancel.setSize(new org.eclipse.swt.graphics.Point(80, 21));
      cancel.setFont(isLocalBtnfont);
      cancel.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent evt) {
              cancelMouseDown(evt);
            }
          });

      FormData enterLData = new FormData();
      enterLData.height = 21;
      enterLData.width = 80;
      enterLData.left = new FormAttachment(623, 1000, 0);
      enterLData.right = new FormAttachment(795, 1000, 0);
      enterLData.top = new FormAttachment(6, 1000, 0);
      enterLData.bottom = new FormAttachment(580, 1000, 0);
      enter.setLayoutData(enterLData);
      enter.setText("ENTER");
      enter.setSize(new org.eclipse.swt.graphics.Point(80, 21));
      enter.setFont(isLocalBtnfont);
      enter.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent evt) {
              enterMouseDown(evt);
            }
          });
      FormLayout composite3Layout = new FormLayout();
      composite3.setLayout(composite3Layout);
      composite3Layout.marginWidth = 0;
      composite3Layout.marginHeight = 0;
      composite3Layout.spacing = 0;
      composite3.layout();
      GridLayout dialogShellLayout = new GridLayout(1, true);
      dialogShell.setLayout(dialogShellLayout);
      dialogShellLayout.marginWidth = 5;
      dialogShellLayout.marginHeight = 5;
      dialogShellLayout.numColumns = 1;
      dialogShellLayout.makeColumnsEqualWidth = true;
      dialogShellLayout.horizontalSpacing = 5;
      dialogShellLayout.verticalSpacing = 5;
      dialogShell.layout();
      dialogShell.addDisposeListener(
          new DisposeListener() {
            public void widgetDisposed(DisposeEvent e) {

              isLocalBtnfont.dispose();
              repositoryIdTxtfont.dispose();
            }
          });
      Rectangle bounds = dialogShell.computeTrim(0, 0, 476, 145);
      dialogShell.setSize(bounds.width, bounds.height);
      postInitGUI();
      dialogShell.open();
      Display display = dialogShell.getDisplay();
      while (!dialogShell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }