@Override
 Map<String, List<String>> initializeKeyValueMap() {
   try {
     Map<String, List<String>> keyValueMap = new HashMap<String, List<String>>();
     LogbookClient logbookClient = LogbookClientManager.getLogbookClientFactory().getClient();
     List<String> logbooks = new ArrayList<String>();
     for (Logbook logbook : logbookClient.listLogbooks()) {
       logbooks.add(logbook.getName());
     }
     List<String> tags = new ArrayList<String>();
     for (Tag tag : logbookClient.listTags()) {
       tags.add(tag.getName());
     }
     List<String> properties = new ArrayList<String>();
     for (Property property : logbookClient.listProperties()) {
       properties.add(property.getName());
     }
     List<String> timeOptions =
         new ArrayList<String>(
             Arrays.asList(
                 "lastMin",
                 "1minAgo",
                 "lastHour",
                 "1hourAgo",
                 "lastDay",
                 "1dayAgo",
                 "lastWeek",
                 "1weekAgo"));
     keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_LOGBOOKS, logbooks);
     keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_TAGS, tags);
     keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_PROPERTIES, properties);
     keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_START, timeOptions);
     keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_END, timeOptions);
     return keyValueMap;
   } catch (Exception e1) {
     return Collections.emptyMap();
   }
 }
  @Override
  protected void okPressed() {
    final Cursor originalCursor = getShell().getCursor();

    getButton(IDialogConstants.OK_ID).setEnabled(false);

    try {
      // get logbook client
      final LogbookClient logbookClient =
          LogbookClientManager.getLogbookClientFactory()
              .getClient(username.getText(), password.getText());
      getShell().setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_WAIT));

      String signature = SecuritySupport.getSubjectName(SecuritySupport.getSubject());
      PropertyBuilder SignOffProperty = property("SignOff").attribute("signature", signature);

      StringBuffer sb = new StringBuffer();
      sb.append("signature:" + signature + System.getProperty("line.separator"));

      final Collection<LogEntry> logEntires = new ArrayList<LogEntry>();
      for (LogEntryBuilder logEntryBuilder : data) {
        logEntryBuilder.addProperty(SignOffProperty);
        sb.append("logEntry: " + logEntryBuilder + System.getProperty("line.separator"));
        logEntires.add(logEntryBuilder.build());
      }
      Job job =
          new Job("Review and Sign Log Entries") {

            @Override
            protected IStatus run(IProgressMonitor monitor) {
              try {
                logbookClient.updateLogEntries(logEntires);
                return Status.OK_STATUS;
              } catch (final Exception e) {
                getShell()
                    .getDisplay()
                    .asyncExec(
                        new Runnable() {

                          @Override
                          public void run() {
                            getShell().setCursor(originalCursor);
                            getButton(IDialogConstants.OK_ID).setEnabled(true);
                            errorBar.setException(e);
                          }
                        });
                return Status.CANCEL_STATUS;
              }
            }
          };
      job.addJobChangeListener(
          new JobChangeAdapter() {
            public void done(IJobChangeEvent event) {
              if (event.getResult().isOK()) {
                getShell()
                    .getDisplay()
                    .asyncExec(
                        new Runnable() {

                          @Override
                          public void run() {
                            getShell().setCursor(originalCursor);
                            getButton(IDialogConstants.OK_ID).setEnabled(true);
                            setReturnCode(OK);
                            close();
                          }
                        });
              }
            }
          });
      job.schedule();
    } catch (Exception ex) {
      getShell().setCursor(originalCursor);
      getButton(IDialogConstants.OK_ID).setEnabled(true);
      errorBar.setException(ex);
    }
  }