private void handleAdd(Shell shell) {

    processElementSelectionDialog(shell);

    senatorList = new LinkedHashSet<String>();
    Job listSenators =
        new Job("Retrieving senator list ...") {

          String selectedCongress = "";

          @Override
          protected IStatus run(IProgressMonitor monitor) {
            senatorList.clear();
            Display.getDefault()
                .syncExec(
                    new Runnable() {
                      @Override
                      public void run() {
                        selectedCongress = congresses[cmbCongress.getSelectionIndex()];
                      }
                    });

            try {
              ArrayList<String> temp = new ArrayList<String>();
              temp.add(0, "All Senators");
              temp.add(1, "All Democrats");
              temp.add(2, "All Republicans");
              temp.add(3, "All Independents");
              if (selectedCongress.equals("All")) {
                for (String s : allSenators) temp.add(s);
              } else {
                if (previousSelectedCongress.isEmpty()
                    || !previousSelectedCongress.equals(selectedCongress)) {
                  availabileSenators = AvailableRecords.getSenators(selectedCongress);
                }
                for (String s : availabileSenators) temp.add(s);
              }
              senatorList.addAll(temp);
              if (selectedSenators != null) senatorList.removeAll(selectedSenators);

              Display.getDefault()
                  .asyncExec(
                      new Runnable() {
                        @Override
                        public void run() {
                          senatorListDialog.refresh(senatorList.toArray());
                        }
                      });
              previousSelectedCongress = selectedCongress;
            } catch (final IOException exception) {
              ConsoleView.printlInConsole(exception.toString());
              Display.getDefault()
                  .syncExec(
                      new Runnable() {

                        @Override
                        public void run() {
                          ErrorDialog.openError(
                              Display.getDefault().getActiveShell(),
                              "Problem Occurred",
                              "Please Check your connectivity to server",
                              new Status(
                                  IStatus.ERROR,
                                  CommonUiActivator.PLUGIN_ID,
                                  "Network is not reachable"));
                        }
                      });
            }
            return Status.OK_STATUS;
          }
        };

    listSenators.schedule();
    senatorList.add("Loading...");
    senatorListDialog.setElements(senatorList.toArray());
    senatorListDialog.setMultipleSelection(true);
    if (senatorListDialog.open() == Window.OK) {
      updateSenatorTable(senatorListDialog.getResult());
    }
  }
 public void processElementSelectionDialog(Shell shell) {
   ILabelProvider lp = new ArrayLabelProvider();
   senatorListDialog = new SenatorListDialog(shell, lp);
   senatorListDialog.setTitle("Select the Authors from the list");
   senatorListDialog.setMessage("Enter Author name to search");
 }